#include<cstdio>
#define min(X,Y)(X<Y?X:Y)
int i,n,m,c,a[50005],d[2000005];
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(!d[a[i]+1000000]) {
d[a[i]+1000000]=1;
c++;
}
}
scanf("%d",&m);
if(m<=n){printf("%d",a[m-1]);return 0;}
m=c+m-n-1;
for(i=0;i<n;i++) {
if(a[i]>=c && a[i]<=m) {
m=min(a[i],m);
}
}
printf("%d",m);
}
# |
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 |
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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9092 KB |
Output is correct |
2 |
Correct |
10 ms |
9092 KB |
Output is correct |
3 |
Correct |
7 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 |
8 ms |
9092 KB |
Output is correct |
7 |
Correct |
9 ms |
9092 KB |
Output is correct |
8 |
Correct |
2 ms |
9092 KB |
Output is correct |
9 |
Correct |
0 ms |
9092 KB |
Output is correct |
10 |
Correct |
11 ms |
9092 KB |
Output is correct |
11 |
Correct |
5 ms |
9092 KB |
Output is correct |
12 |
Correct |
3 ms |
9092 KB |
Output is correct |
13 |
Correct |
2 ms |
9092 KB |
Output is correct |
14 |
Correct |
2 ms |
9092 KB |
Output is correct |
15 |
Correct |
0 ms |
9092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9092 KB |
Output is correct |
2 |
Correct |
3 ms |
9092 KB |
Output is correct |
3 |
Correct |
4 ms |
9092 KB |
Output is correct |
4 |
Correct |
0 ms |
9092 KB |
Output is correct |
5 |
Correct |
9 ms |
9092 KB |
Output is correct |
6 |
Correct |
6 ms |
9092 KB |
Output is correct |
7 |
Correct |
6 ms |
9092 KB |
Output is correct |
8 |
Correct |
3 ms |
9092 KB |
Output is correct |
9 |
Correct |
2 ms |
9092 KB |
Output is correct |
10 |
Correct |
6 ms |
9092 KB |
Output is correct |
11 |
Correct |
5 ms |
9092 KB |
Output is correct |
12 |
Correct |
0 ms |
9092 KB |
Output is correct |
13 |
Correct |
5 ms |
9092 KB |
Output is correct |
14 |
Correct |
0 ms |
9092 KB |
Output is correct |
15 |
Correct |
0 ms |
9092 KB |
Output is correct |