#include <bits/stdc++.h>
using namespace std;
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)m=min(m,a[i]);
printf("%d",m);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
9728 KB |
Output is correct |
2 |
Correct |
0 ms |
9728 KB |
Output is correct |
3 |
Correct |
0 ms |
9728 KB |
Output is correct |
4 |
Correct |
0 ms |
9728 KB |
Output is correct |
5 |
Correct |
0 ms |
9728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
9728 KB |
Output is correct |
2 |
Correct |
0 ms |
9728 KB |
Output is correct |
3 |
Correct |
0 ms |
9728 KB |
Output is correct |
4 |
Correct |
0 ms |
9728 KB |
Output is correct |
5 |
Correct |
0 ms |
9728 KB |
Output is correct |
6 |
Correct |
0 ms |
9728 KB |
Output is correct |
7 |
Correct |
0 ms |
9728 KB |
Output is correct |
8 |
Correct |
0 ms |
9728 KB |
Output is correct |
9 |
Correct |
0 ms |
9728 KB |
Output is correct |
10 |
Correct |
0 ms |
9728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
9728 KB |
Output is correct |
2 |
Correct |
10 ms |
9728 KB |
Output is correct |
3 |
Correct |
4 ms |
9728 KB |
Output is correct |
4 |
Correct |
6 ms |
9728 KB |
Output is correct |
5 |
Correct |
13 ms |
9728 KB |
Output is correct |
6 |
Correct |
8 ms |
9728 KB |
Output is correct |
7 |
Correct |
9 ms |
9728 KB |
Output is correct |
8 |
Correct |
8 ms |
9728 KB |
Output is correct |
9 |
Correct |
0 ms |
9728 KB |
Output is correct |
10 |
Correct |
3 ms |
9728 KB |
Output is correct |
11 |
Correct |
0 ms |
9728 KB |
Output is correct |
12 |
Correct |
0 ms |
9728 KB |
Output is correct |
13 |
Correct |
0 ms |
9728 KB |
Output is correct |
14 |
Correct |
5 ms |
9728 KB |
Output is correct |
15 |
Correct |
0 ms |
9728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
9728 KB |
Output is correct |
2 |
Correct |
0 ms |
9728 KB |
Output is correct |
3 |
Correct |
0 ms |
9728 KB |
Output is correct |
4 |
Correct |
8 ms |
9728 KB |
Output is correct |
5 |
Correct |
0 ms |
9728 KB |
Output is correct |
6 |
Correct |
0 ms |
9728 KB |
Output is correct |
7 |
Correct |
10 ms |
9728 KB |
Output is correct |
8 |
Correct |
0 ms |
9728 KB |
Output is correct |
9 |
Correct |
12 ms |
9728 KB |
Output is correct |
10 |
Correct |
0 ms |
9728 KB |
Output is correct |
11 |
Correct |
10 ms |
9728 KB |
Output is correct |
12 |
Correct |
0 ms |
9728 KB |
Output is correct |
13 |
Correct |
11 ms |
9728 KB |
Output is correct |
14 |
Correct |
0 ms |
9728 KB |
Output is correct |
15 |
Correct |
9 ms |
9728 KB |
Output is correct |