#include<stdio.h>
#define X 1000000
int check[2000005];
int main()
{
int n, m[50005], k, i, cnt=0, a;
scanf("%d",&n);
for(i=1 ; i<=n ; i++)
{
scanf("%d",&m[i]);
if(check[m[i]+X]==0) cnt++, check[m[i]+X]=1;
}
scanf("%d",&k);
if(n>=k) printf("%d",m[k]);
else
{
a=n;
while(a<=k-2)
{
if(check[cnt+X]==0)
{
check[cnt+X]=1;
cnt++;
}
else break;
a++;
}
printf("%d",cnt);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
8968 KB |
Output is correct |
2 |
Correct |
0 ms |
8968 KB |
Output is correct |
3 |
Correct |
0 ms |
8972 KB |
Output is correct |
4 |
Correct |
0 ms |
8968 KB |
Output is correct |
5 |
Correct |
0 ms |
8972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
8964 KB |
Output is correct |
2 |
Correct |
0 ms |
8972 KB |
Output is correct |
3 |
Correct |
0 ms |
8968 KB |
Output is correct |
4 |
Correct |
0 ms |
8972 KB |
Output is correct |
5 |
Correct |
0 ms |
8968 KB |
Output is correct |
6 |
Correct |
0 ms |
8968 KB |
Output is correct |
7 |
Correct |
0 ms |
8964 KB |
Output is correct |
8 |
Correct |
0 ms |
8968 KB |
Output is correct |
9 |
Correct |
0 ms |
8968 KB |
Output is correct |
10 |
Correct |
0 ms |
8972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
8964 KB |
Output is correct |
2 |
Correct |
0 ms |
8968 KB |
Output is correct |
3 |
Correct |
10 ms |
8972 KB |
Output is correct |
4 |
Correct |
0 ms |
8972 KB |
Output is correct |
5 |
Correct |
12 ms |
8964 KB |
Output is correct |
6 |
Correct |
4 ms |
8968 KB |
Output is correct |
7 |
Correct |
0 ms |
8964 KB |
Output is correct |
8 |
Correct |
9 ms |
8964 KB |
Output is correct |
9 |
Correct |
1 ms |
8964 KB |
Output is correct |
10 |
Correct |
8 ms |
8964 KB |
Output is correct |
11 |
Correct |
5 ms |
8968 KB |
Output is correct |
12 |
Correct |
0 ms |
8968 KB |
Output is correct |
13 |
Correct |
8 ms |
8968 KB |
Output is correct |
14 |
Correct |
0 ms |
8968 KB |
Output is correct |
15 |
Correct |
0 ms |
8968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
8972 KB |
Output isn't correct |
2 |
Correct |
0 ms |
8972 KB |
Output is correct |
3 |
Correct |
0 ms |
8972 KB |
Output is correct |
4 |
Incorrect |
6 ms |
8972 KB |
Output isn't correct |
5 |
Incorrect |
5 ms |
8968 KB |
Output isn't correct |
6 |
Incorrect |
10 ms |
8972 KB |
Output isn't correct |
7 |
Incorrect |
10 ms |
8968 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
8964 KB |
Output isn't correct |
9 |
Correct |
10 ms |
8972 KB |
Output is correct |
10 |
Incorrect |
0 ms |
8972 KB |
Output isn't correct |
11 |
Correct |
0 ms |
8968 KB |
Output is correct |
12 |
Correct |
9 ms |
8968 KB |
Output is correct |
13 |
Incorrect |
0 ms |
8968 KB |
Output isn't correct |
14 |
Correct |
0 ms |
8972 KB |
Output is correct |
15 |
Incorrect |
5 ms |
8968 KB |
Output isn't correct |