-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMEXPartition.cpp
More file actions
65 lines (58 loc) · 1.18 KB
/
MEXPartition.cpp
File metadata and controls
65 lines (58 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pii pair<int, int>
#define vi vector<int>
#define vpii vector<pii>
#define vvi vector<vector<int>>
#define vvpii vector<vector<pii>>
#define vvvi vector<vector<vector<int>>>
#define mod 1000000007
#define INT_MAX LLONG_MAX
#define pb push_back
// Loop macros
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define FORR(i, a, b) for(int i = a; i > b; --i)
#define FOREACH(x, a) for(auto& x : a)
// modulus
int m1(int a, int b, int m=mod) {
int result = (a % m + b % m) % m;
return ((result + m) % m);
}
int abs(int a, int b) {
return a > b ? a - b : b - a;
}
int p1(int a, int b, int m=mod) {
int result = (a % m * b % m) % m;
return ((result + m) % m);
}
void ans(){
int n;
cin>>n;
vi a(n);
set<int>s;
FOR(i,0,n){
cin>>a[i];
s.insert(a[i]);
}
int j = 0;
for(auto&i:s){
if(i!=j){
cout<<j;
return;
}
j++;
}
cout<<j;
return;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int t=1;
cin>>t;
while(t--){
ans();
cout<<endl;
}
}