Mode

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

You are given an array aa of length nn. Define cnt_x\mathit{cnt}\_x as the number of occurrences of xx in aa.

Now you can do the following operation at most once: select a non-empty subarray a_l,a_l+1,a_l+2,,a_ra\_l, a\_{l+1}, a\_{l+2}, \ldots, a\_r and an integer k\[109,109]k \in \[-10^9, 10^9], and add kk to all the elements in the subarray.

Your first task is to find the maximum possible value of W=maxcnt_xxZW = \max\\{\mathit{cnt}\_x \mid x \in \mathbb{Z}\\} after one operation. Your second task is to find all vv such that cnt_v=W\mathit{cnt}\_v = W can be achieved after one operation.

입력

The first line contains an integer TT (1T201 \leq T \leq 20), the number of test cases.

Each test case consists of two lines. The first line contains a single integer nn (2n21052 \leq n \leq 2 \cdot 10^5), and the second line contains nn integers denoting the array (1a_i1091 \le a\_i \le 10^9).

It is guaranteed that n5105\sum n \leq 5 \cdot 10^5, and a_ia\_i are not all the same.

출력

For each test case, output one integer on the first line, denoting the maximum value WW. Then for all integers vv satisfying the condition, output them in ascending order.

힌트

The values of WW for the test cases are 44, 55, 44, 22.