| Codeforces Round 1067 (Div. 2) |
|---|
| Finished |
You are given a sequence $$$a$$$ containing $$$2n$$$ integers. Let $$$f(b)$$$ denote the number of distinct elements with an odd number of occurrences in sequence $$$b$$$. You need to split the given array into two disjoint subsequences $$$p$$$ and $$$q$$$, each of size $$$n$$$, such that $$$f(p) + f(q)$$$ is maximized. Output the maximum value.
A sequence $$$a$$$ is a subsequence of a sequence $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by the deletion of several (possibly, zero or all) element from arbitrary positions.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$).
The second line contains $$$2n$$$ integers $$$a_1,a_2,\ldots,a_{2n}$$$ ($$$1 \le a_i \le 2n$$$) — the elements of sequence $$$a$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, print one line.
You have to print the maximum value of $$$f(p) + f(q)$$$ that can be achieved.
721 2 3 435 5 5 5 5 543 3 7 6 3 7 8 722 2 2 261 2 3 4 5 4 1 4 1 5 4 641 2 1 2 1 2 1 259 9 9 7 7 7 9 7 7 7
4240842
For the first test case:
For the second test case:
For the fifth test case:
| Name |
|---|


