CodeTON Round 8 (Div. 1 + Div. 2, Rated, Prizes!)
C1
Bessie's Birthday Cake (Easy Version)
Codeforces
1300
原题
← BC2 →
翻译中…

This is the easy version of the problem. The only difference between the two versions is the constraint on $y$. In this version $y = 0$. You can make hacks only if both versions are solved.

翻译中…

Bessie has received a birthday cake from her best friend Elsie, and it came in the form of a regular polygon with $n$ sides. The vertices of the cake are numbered from $1$ to $n$ clockwise. You and Bessie are going to choose some of those vertices to cut non-intersecting diagonals into the cake. In other words, the endpoints of the diagonals must be part of the chosen vertices.

翻译中…

Bessie would only like to give out pieces of cake which result in a triangle to keep consistency. The size of the pieces doesn't matter, and the whole cake does not have to be separated into all triangles (other shapes are allowed in the cake, but those will not be counted).

翻译中…

Bessie has already chosen $x$ of those vertices that can be used to form diagonals. She wants you to choose no more than $y$ other vertices such that the number of triangular pieces of cake she can give out is maximized.

翻译中…

What is the maximum number of triangular pieces of cake Bessie can give out?

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

翻译中…

The first line of each test case consists of three integers, $n$, $x$, and $y$ ($4 \leq n \leq 10^9$, $2 \leq x \leq \min(n, 2 \cdot 10^5)$, $y = 0$) — the number of sides of the polygon, number of vertices Bessie has chosen, and the maximum number of other vertices you can choose.

翻译中…

The second line consists of $x$ distinct integers from $1$ to $n$, representing the vertices Bessie has chosen.

翻译中…

It is guaranteed the sum of $x$ over all test cases does not exceed $2 \cdot 10^5$.

翻译中…

Output

翻译中…

For each test case, output a single integer: the maximum number of non-intersecting triangular pieces of cake she can give out.

翻译中…

Note

翻译中…

In test cases $1$, $2$ and $3$, you can get $2$, $6$ and $2$ non-intersecting triangular pieces of cake, respectively. A possible construction is shown in the following pictures:

翻译中…

The green dots represent vertices that can be used, the blue lines represent diagonals that are drawn, and the red numbers represent triangles that are counted.

翻译中…

image

翻译中…

样例

Input #1
3
8 4 0
1 6 2 5
8 8 0
1 3 2 5 4 6 7 8
4 2 0
1 3
Output #1
2
6
2
InputCopy OutputCopy
题目信息
题号
1942C1
时间限制
2 s
内存限制
256 MB
标签
计算几何
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。