#include<stdio.h>
#define N 1000000
int chk[2*N+5],n,m,max,cnt,b[50005];
FILE *in,*out;
int main(){
int i,x;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&x);
if(chk[x+N]==1) continue;
chk[x+N]=1;
cnt++;
b[i]=x;
max=max>x?max:x;
}
scanf("%d",&m);
for(i=1;i<=n;i++){
if(i==m){
printf("%d\n",b[i]);
return 0;
}
}
if(cnt>max){
printf("%d\n",cnt+m-n-1);
return 0;
}
while(1){
if(chk[N+cnt]==1 || i==m){
printf("%d\n",cnt);
return 0;
}
chk[N+cnt]=1;
cnt++;
i++;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
9092 KB |
Output is correct |
2 |
Correct |
0 ms |
9092 KB |
Output is correct |
3 |
Correct |
0 ms |
9092 KB |
Output is correct |
4 |
Incorrect |
0 ms |
9092 KB |
Output isn't correct |
5 |
Correct |
0 ms |
9092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
9092 KB |
Output is correct |
2 |
Correct |
0 ms |
9092 KB |
Output is correct |
3 |
Correct |
0 ms |
9092 KB |
Output is correct |
4 |
Correct |
0 ms |
9092 KB |
Output is correct |
5 |
Correct |
0 ms |
9092 KB |
Output is correct |
6 |
Correct |
0 ms |
9092 KB |
Output is correct |
7 |
Correct |
0 ms |
9092 KB |
Output is correct |
8 |
Correct |
0 ms |
9092 KB |
Output is correct |
9 |
Correct |
0 ms |
9092 KB |
Output is correct |
10 |
Correct |
0 ms |
9092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
9092 KB |
Output is correct |
2 |
Correct |
0 ms |
9092 KB |
Output is correct |
3 |
Incorrect |
0 ms |
9092 KB |
Output isn't correct |
4 |
Correct |
10 ms |
9092 KB |
Output is correct |
5 |
Correct |
12 ms |
9092 KB |
Output is correct |
6 |
Correct |
8 ms |
9092 KB |
Output is correct |
7 |
Correct |
0 ms |
9092 KB |
Output is correct |
8 |
Correct |
0 ms |
9092 KB |
Output is correct |
9 |
Correct |
8 ms |
9092 KB |
Output is correct |
10 |
Correct |
5 ms |
9092 KB |
Output is correct |
11 |
Incorrect |
8 ms |
9092 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
9092 KB |
Output isn't correct |
13 |
Correct |
0 ms |
9092 KB |
Output is correct |
14 |
Correct |
0 ms |
9092 KB |
Output is correct |
15 |
Correct |
0 ms |
9092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
9092 KB |
Output is correct |
2 |
Correct |
0 ms |
9092 KB |
Output is correct |
3 |
Correct |
4 ms |
9092 KB |
Output is correct |
4 |
Correct |
10 ms |
9092 KB |
Output is correct |
5 |
Correct |
0 ms |
9092 KB |
Output is correct |
6 |
Correct |
5 ms |
9092 KB |
Output is correct |
7 |
Correct |
1 ms |
9092 KB |
Output is correct |
8 |
Correct |
0 ms |
9092 KB |
Output is correct |
9 |
Correct |
3 ms |
9092 KB |
Output is correct |
10 |
Correct |
7 ms |
9092 KB |
Output is correct |
11 |
Correct |
6 ms |
9092 KB |
Output is correct |
12 |
Correct |
6 ms |
9092 KB |
Output is correct |
13 |
Correct |
9 ms |
9092 KB |
Output is correct |
14 |
Correct |
7 ms |
9092 KB |
Output is correct |
15 |
Correct |
0 ms |
9092 KB |
Output is correct |