Codeforces Round 1075 (Div. 2)
A
Table with Numbers
Codeforces
800
原题
←B →
翻译中…

Peter drew a table of size $h \times l$, filled with zeros. We will number its rows from $1$ to $h$ from top to bottom, and columns from $1$ to $l$ from left to right. Ned came up with an array of numbers $a_1, a_2, \ldots, a_n$ and wanted to modify the table.

翻译中…

Ned can choose $2k \leq n$ numbers from his array and split them into $k$ pairs. After that, for each resulting pair $x, y$, he takes the cell located in row $x$ and column $y$, and adds $1$ to the number in that cell. If such a cell does not exist, then this pair does nothing to the table.

翻译中…

Peter supported Ned's initiative and asked him to maximize the sum of the numbers in the table. Help Ned understand what the maximum sum he can achieve is.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 500$). The description of the test cases follows.

翻译中…

The first line of each test case contains three integers $n$, $h$, and $l$ ($2 \le n \le 100$, $1 \le h, l \le 1000$) — the size of the array, the height of the table, and the width of the table, respectively.

翻译中…

The second line of each test case contains $n$ numbers $a_1$, $a_2$, $\ldots$, $a_n$ ($1 \le a_i \le 1000$) — the array itself.

翻译中…

Output

翻译中…

For each test case, output the maximum possible sum of the numbers in the table.

翻译中…

Note

翻译中…

In the first test case, Ned can take the pair $(1, 1)$ and add $1$ to the number located in row $1$ and column $1$.

翻译中…

In the second test case, Ned can take the numbers $1, 2, 2, 2$ and pair them as follows: $(1, 2), (2, 2)$. Then, in two cells of the table, there will be a $1$, and the sum will be equal to $2$. It can be shown that it is not possible to achieve a higher sum.

翻译中…

In the fifth test case, the only pair that Ned can take is $(5, 5)$. Since such a cell does not exist in the table, the sum of the numbers in the table cannot exceed $0$.

翻译中…

In the seventh test case, Ned can pair the numbers like this: $(1, 1), (1, 1)$. Then the only cell in the table will contain the number $2$, and the sum will also be $2$. It can be shown that it is not possible to achieve a higher sum.

翻译中…

样例

Input #1
7
2 1 1
1 1
5 2 2
1 2 2 3 2
8 4 2
7 2 2 2 3 4 4 2
7 3 6
10 4 1 3 5 4 6
2 4 4
5 5
7 6 3
10 4 1 3 5 4 6
4 1 1
1 1 1 1
Output #1
1
2
3
2
0
2
2
InputCopy OutputCopy
题目信息
题号
2189A
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟

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