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>
int p[50050], cnt;
bool chk[2000020];
int main(){
int n, m;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",p+i);
scanf("%d",&m);
if(m<=n)return printf("%d",p[m-1]) & 0;
for(int i=0;i<n;i++){
if(!chk[p[i]+1000000])chk[p[i]+1000000] = 1, cnt++;
}
int i;
for(i=cnt+1000000;i<=2000000 && i<cnt+1000000+m-n-1;i++){
if(chk[i])break;
}
if(i == 2000001)printf("%d",m-n+cnt-1);
else printf("%d",i-1000000);
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... |