Codeforces Round 1058 (Div. 2)
A
MEX Partition
Codeforces
800
原题
←B →
翻译中…

Let a partition of a multiset $B$ be a collection of multisets $s_1, s_2,\ldots, s_k$ such that each element appears the same number of times in $B$ and across all of $s_1,s_2,\ldots,s_k$.

翻译中…

For example, some partitions of $\{1,2,3,3\}$ include $\{1,3\}+\{2,3\}, \{1,2,3,3\}$, and $\{2\}+\{1,3\}+\{3\}$, but not $\{1,2\}+\{3\}$.

翻译中…

A partition is called valid if the $\operatorname{mex}$$^{\text{∗}}$ of all multisets in the partition is the same. The score of a valid partition is the $\operatorname{mex}$ of any multiset in the partition.

翻译中…

You are given a multiset $A$ of size $n$. Find the minimum score over all valid partitions of $A$.

翻译中…

$^{\text{∗}}$The minimum excluded (MEX) of a collection of integers $c_1, c_2, \ldots, c_k$ is defined as the smallest non-negative integer $x$ which does not occur in the collection $c$.

翻译中…

Input

翻译中…

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

翻译中…

The first line of each test case contains an integer $n$ ($1 \leq n \leq 100$).

翻译中…

The second line contains $n$ integers $A_1, A_2, \ldots, A_n$ denoting the elements of $A$ ($0 \leq A_i \leq 100$).

翻译中…

It is not guaranteed that the elements are given in non-decreasing order.

翻译中…

Output

翻译中…

For each test case, output the minimum score over all valid partitions.

翻译中…

Note

翻译中…

In the first test case, the minimum score of $1$ can be obtained by the partition $\{0\}+\{0\}+\{0\}$. The partition is valid because each multiset has a $\operatorname{mex}$ of $1$, which is consequently the score of the partition.

翻译中…

In the second test case, we can use $\{1,2\}$ as the only multiset in the partition, which has $\operatorname{mex} 0$.

翻译中…

样例

Input #1
2
3
0 0 0
2
1 2
Output #1
1
0
InputCopy OutputCopy
题目信息
题号
2160A
时间限制
1 s
内存限制
256 MB
标签
数学

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