Codeforces Round 983 (Div. 2) |
---|
Finished |
You are given a cyclic array $$$a$$$ with $$$n$$$ elements, where $$$n$$$ is odd. In each operation, you can do the following:
A cyclic array is called balanced if all its elements are equal to each other.
Find any sequence of operations to make this cyclic array balanced or determine that it is impossible. Please note that you do not have to minimize the number of operations.
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^5$$$) — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n < 2 \cdot 10^5$$$, $$$n$$$ is odd) — the length of the array $$$a$$$.
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^{6}$$$) — the elements of the array $$$a$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case:
632 1 231 2 351 2 1 2 171 2 1 2 1 3 1910000 10000 10000 10000 10000 10001 10002 10001 10000110
0 1 0 2 1 0 2 0 3 0 2 4 2 7 0 8 0 6 1 1 1 1 1 1 0 1 1 0
In the first test case:
In the second test case:
In the third test case:
Name |
---|