#include <cstdio>
int n,m;
int ip[50010];
bool arr[2000010];
int main(){
int i,now=0,a;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&ip[i]); ip[i]+=1000000;
if(!arr[ip[i]]) now++; arr[ip[i]]=1;
}
scanf("%d",&m); now+=1000000;
if(m<=n){ printf("%d",ip[m]-1000000); return 0; } m-=n+1;
while(m && now<=2000005 && !arr[now]) now++,m--;
if(now<=2000005) printf("%d",now-1000000);
else printf("%d",now+m-1000000);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3232 KB |
Output is correct |
2 |
Correct |
0 ms |
3232 KB |
Output is correct |
3 |
Correct |
0 ms |
3232 KB |
Output is correct |
4 |
Correct |
0 ms |
3232 KB |
Output is correct |
5 |
Correct |
0 ms |
3232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3232 KB |
Output is correct |
2 |
Correct |
0 ms |
3232 KB |
Output is correct |
3 |
Correct |
0 ms |
3232 KB |
Output is correct |
4 |
Correct |
0 ms |
3232 KB |
Output is correct |
5 |
Correct |
0 ms |
3232 KB |
Output is correct |
6 |
Correct |
0 ms |
3232 KB |
Output is correct |
7 |
Correct |
0 ms |
3232 KB |
Output is correct |
8 |
Correct |
0 ms |
3232 KB |
Output is correct |
9 |
Correct |
0 ms |
3232 KB |
Output is correct |
10 |
Correct |
0 ms |
3232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
3232 KB |
Output is correct |
2 |
Correct |
7 ms |
3232 KB |
Output is correct |
3 |
Correct |
4 ms |
3232 KB |
Output is correct |
4 |
Correct |
5 ms |
3232 KB |
Output is correct |
5 |
Correct |
10 ms |
3232 KB |
Output is correct |
6 |
Correct |
7 ms |
3232 KB |
Output is correct |
7 |
Correct |
0 ms |
3232 KB |
Output is correct |
8 |
Correct |
9 ms |
3232 KB |
Output is correct |
9 |
Correct |
2 ms |
3232 KB |
Output is correct |
10 |
Correct |
7 ms |
3232 KB |
Output is correct |
11 |
Correct |
7 ms |
3232 KB |
Output is correct |
12 |
Correct |
4 ms |
3232 KB |
Output is correct |
13 |
Correct |
6 ms |
3232 KB |
Output is correct |
14 |
Correct |
0 ms |
3232 KB |
Output is correct |
15 |
Correct |
2 ms |
3232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3232 KB |
Output is correct |
2 |
Correct |
9 ms |
3232 KB |
Output is correct |
3 |
Correct |
9 ms |
3232 KB |
Output is correct |
4 |
Correct |
0 ms |
3232 KB |
Output is correct |
5 |
Correct |
7 ms |
3232 KB |
Output is correct |
6 |
Correct |
10 ms |
3232 KB |
Output is correct |
7 |
Correct |
9 ms |
3232 KB |
Output is correct |
8 |
Correct |
0 ms |
3232 KB |
Output is correct |
9 |
Correct |
0 ms |
3232 KB |
Output is correct |
10 |
Correct |
10 ms |
3232 KB |
Output is correct |
11 |
Correct |
7 ms |
3232 KB |
Output is correct |
12 |
Correct |
6 ms |
3232 KB |
Output is correct |
13 |
Correct |
0 ms |
3232 KB |
Output is correct |
14 |
Correct |
3 ms |
3232 KB |
Output is correct |
15 |
Correct |
0 ms |
3232 KB |
Output is correct |