rt,被这个数据卡了,但我觉得答案就是2(标准答案是3),我认为Bob可以直接偷袭唯一一个2,然后使c中的mex变成2,数据:
9
1 0 7 7 7 6 1 2 0
# include <bits/stdc++.h>
# define ffor(i,name) \
for (auto i = name.begin (); i != name.end (); ++ i)
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
int t, n, a[200005], x, now;
int main () {
ios::sync_with_stdio (0);
cin.tie (0);
cout.tie (0);
cin >> t;
while (t --) {
cin >> n;
for (int i = 0; i <= n; ++ i)
a[i] = 0;
for (int i = 0; i < n; ++ i)
cin >> x, ++ a[x];
now = 0;
for (int i = 0; i <= n; ++ i)
if (now >= a[i]) {
cout << i << '\n';
break ;
} else
++ now;
}
return 0;
}
/*
1
9
1 0 7 7 7 6 1 2 0
*/