#include<stdio.h>
int p[50050], cnt;
bool chk[2000020];
int main(){
int n, m;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",p+i);
scanf("%d",&m);
if(m<=n)return printf("%d",p[m-1]) & 0;
for(int i=0;i<n;i++){
if(!chk[p[i]+1000000])chk[p[i]+1000000] = 1, cnt++;
}
int i;
for(i=cnt+1000000;i<=2000000 && i<cnt+1000000+m-n-1;i++){
if(chk[i])break;
}
if(i == 2000001)printf("%d",m-n+cnt-1);
else printf("%d",i-1000000);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
3232 KB |
Output is correct |
2 |
Correct |
0 ms |
3232 KB |
Output is correct |
3 |
Correct |
2 ms |
3232 KB |
Output is correct |
4 |
Correct |
6 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 |
5 ms |
3232 KB |
Output is correct |
8 |
Correct |
1 ms |
3232 KB |
Output is correct |
9 |
Correct |
0 ms |
3232 KB |
Output is correct |
10 |
Correct |
7 ms |
3232 KB |
Output is correct |
11 |
Correct |
0 ms |
3232 KB |
Output is correct |
12 |
Correct |
3 ms |
3232 KB |
Output is correct |
13 |
Correct |
7 ms |
3232 KB |
Output is correct |
14 |
Correct |
4 ms |
3232 KB |
Output is correct |
15 |
Correct |
0 ms |
3232 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
3232 KB |
Output is correct |
2 |
Correct |
4 ms |
3232 KB |
Output is correct |
3 |
Correct |
10 ms |
3232 KB |
Output is correct |
4 |
Correct |
12 ms |
3232 KB |
Output is correct |
5 |
Correct |
8 ms |
3232 KB |
Output is correct |
6 |
Correct |
9 ms |
3232 KB |
Output is correct |
7 |
Correct |
5 ms |
3232 KB |
Output is correct |
8 |
Correct |
0 ms |
3232 KB |
Output is correct |
9 |
Correct |
7 ms |
3232 KB |
Output is correct |
10 |
Correct |
0 ms |
3232 KB |
Output is correct |
11 |
Correct |
3 ms |
3232 KB |
Output is correct |
12 |
Correct |
3 ms |
3232 KB |
Output is correct |
13 |
Correct |
7 ms |
3232 KB |
Output is correct |
14 |
Correct |
0 ms |
3232 KB |
Output is correct |
15 |
Correct |
0 ms |
3232 KB |
Output is correct |