#include <stdio.h>
int a[50010],chk[2000010],s;
int main(){
int i,n,m;
scanf("%d",&n);
for(i=1;i<=n;++i){
scanf("%d",a+i);
if(!chk[a[i]+1000000])chk[a[i]+1000000]=1,++s;
}
scanf("%d",&m);
if(m<=n){
printf("%d",a[m]);
return 0;
}
m-=n-s+1;
for(i=1;i<=n;++i)if(s<=a[i]&&a[i]<=m)break;
if(i>n)printf("%d",m);
else printf("%d",a[i]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9092 KB |
Output is correct |
2 |
Incorrect |
0 ms |
9092 KB |
Output isn't 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 |
Incorrect |
0 ms |
9092 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
9092 KB |
Output isn't correct |
9 |
Correct |
0 ms |
9092 KB |
Output is correct |
10 |
Correct |
0 ms |
9092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9092 KB |
Output is correct |
2 |
Correct |
4 ms |
9092 KB |
Output is correct |
3 |
Correct |
12 ms |
9092 KB |
Output is correct |
4 |
Incorrect |
3 ms |
9092 KB |
Output isn't correct |
5 |
Correct |
3 ms |
9092 KB |
Output is correct |
6 |
Correct |
4 ms |
9092 KB |
Output is correct |
7 |
Correct |
11 ms |
9092 KB |
Output is correct |
8 |
Correct |
4 ms |
9092 KB |
Output is correct |
9 |
Correct |
5 ms |
9092 KB |
Output is correct |
10 |
Incorrect |
0 ms |
9092 KB |
Output isn't correct |
11 |
Correct |
21 ms |
9092 KB |
Output is correct |
12 |
Correct |
7 ms |
9092 KB |
Output is correct |
13 |
Correct |
0 ms |
9092 KB |
Output is correct |
14 |
Incorrect |
0 ms |
9092 KB |
Output isn't correct |
15 |
Correct |
6 ms |
9092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
9092 KB |
Output isn't correct |
2 |
Correct |
6 ms |
9092 KB |
Output is correct |
3 |
Correct |
3 ms |
9092 KB |
Output is correct |
4 |
Correct |
6 ms |
9092 KB |
Output is correct |
5 |
Correct |
3 ms |
9092 KB |
Output is correct |
6 |
Correct |
2 ms |
9092 KB |
Output is correct |
7 |
Correct |
5 ms |
9092 KB |
Output is correct |
8 |
Incorrect |
3 ms |
9092 KB |
Output isn't correct |
9 |
Correct |
1 ms |
9092 KB |
Output is correct |
10 |
Incorrect |
8 ms |
9092 KB |
Output isn't correct |
11 |
Correct |
6 ms |
9092 KB |
Output is correct |
12 |
Incorrect |
14 ms |
9092 KB |
Output isn't correct |
13 |
Correct |
8 ms |
9092 KB |
Output is correct |
14 |
Correct |
0 ms |
9092 KB |
Output is correct |
15 |
Incorrect |
4 ms |
9092 KB |
Output isn't correct |