This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |