#include<cstdio>
#include<algorithm>
#include<set>
int s[50001];
int b[5000000];
std::set<int> st;
int main()
{
int n,m,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&s[i]),b[i]=s[i],st.insert(s[i]);
std::set<int>::iterator k=st.upper_bound(st.size()-1);
scanf("%d",&m);
if(m<=n) printf("%d",b[m]);
else if(m<=n+(*k-st.size()+1)) printf("%d",m-n-1+st.size());
else printf("%d",*k);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
20936 KB |
Output is correct |
2 |
Correct |
0 ms |
20936 KB |
Output is correct |
3 |
Correct |
0 ms |
20936 KB |
Output is correct |
4 |
Correct |
0 ms |
20936 KB |
Output is correct |
5 |
Correct |
0 ms |
20936 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
20936 KB |
Output isn't correct |
2 |
Correct |
0 ms |
20936 KB |
Output is correct |
3 |
Incorrect |
0 ms |
20936 KB |
Output isn't correct |
4 |
Correct |
0 ms |
20936 KB |
Output is correct |
5 |
Correct |
0 ms |
20936 KB |
Output is correct |
6 |
Incorrect |
0 ms |
20936 KB |
Output isn't correct |
7 |
Correct |
0 ms |
20936 KB |
Output is correct |
8 |
Incorrect |
0 ms |
20936 KB |
Output isn't correct |
9 |
Correct |
0 ms |
20936 KB |
Output is correct |
10 |
Correct |
0 ms |
20936 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
22916 KB |
Output is correct |
2 |
Correct |
26 ms |
23180 KB |
Output is correct |
3 |
Correct |
31 ms |
23180 KB |
Output is correct |
4 |
Incorrect |
16 ms |
21464 KB |
Output isn't correct |
5 |
Incorrect |
6 ms |
20936 KB |
Output isn't correct |
6 |
Correct |
11 ms |
20936 KB |
Output is correct |
7 |
Incorrect |
19 ms |
22388 KB |
Output isn't correct |
8 |
Incorrect |
5 ms |
20936 KB |
Output isn't correct |
9 |
Correct |
7 ms |
20936 KB |
Output is correct |
10 |
Correct |
4 ms |
21332 KB |
Output is correct |
11 |
Correct |
0 ms |
21332 KB |
Output is correct |
12 |
Incorrect |
0 ms |
20936 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
20936 KB |
Output isn't correct |
14 |
Correct |
0 ms |
20936 KB |
Output is correct |
15 |
Correct |
3 ms |
21200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
20936 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
20936 KB |
Output isn't correct |
3 |
Correct |
0 ms |
20936 KB |
Output is correct |
4 |
Incorrect |
4 ms |
20936 KB |
Output isn't correct |
5 |
Incorrect |
9 ms |
20936 KB |
Output isn't correct |
6 |
Correct |
26 ms |
23180 KB |
Output is correct |
7 |
Incorrect |
4 ms |
20936 KB |
Output isn't correct |
8 |
Incorrect |
7 ms |
20936 KB |
Output isn't correct |
9 |
Correct |
23 ms |
22916 KB |
Output is correct |
10 |
Incorrect |
21 ms |
22388 KB |
Output isn't correct |
11 |
Correct |
25 ms |
23180 KB |
Output is correct |
12 |
Correct |
3 ms |
21200 KB |
Output is correct |
13 |
Incorrect |
16 ms |
21464 KB |
Output isn't correct |
14 |
Correct |
5 ms |
21332 KB |
Output is correct |
15 |
Incorrect |
3 ms |
20936 KB |
Output isn't correct |