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<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<cstring>
int a,b,i,s,p,x[55555],c[2000002],M=1000000;
main()
{
scanf("%d",&a);
for(i=1;i<=a;i++)
{
scanf("%d",&x[i]);
c[M+x[i]]++;
if(c[M+x[i]]==1)s++;
}
scanf("%d",&b);
if(b<=a)
{
printf("%d",x[b]);
return 0;
}
else
{
for(i=a+1;i<=b&&i<=M;i++)
{
if(c[s+M]==0)
{
c[s+M]=1;
s++;
}
else
{
p=1;
s++;
break;
}
}
if(b<=M)printf("%d",s-1);
else
{
if(p==1)printf("%d",s-1);
else
{
printf("%d",b-M+s-1);
}
}
}
}
# | 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... |