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>
int n,m;
int ip[50010];
bool arr[2000010];
int main(){
int i,now=0,a;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&ip[i]); ip[i]+=1000000;
if(!arr[ip[i]]) now++; arr[ip[i]]=1;
}
scanf("%d",&m); now+=1000000;
if(m<=n){ printf("%d",ip[m]-1000000); return 0; } m-=n+1;
while(m && now<=2000005 && !arr[now]) now++,m--;
if(now<=2000005) printf("%d",now-1000000);
else printf("%d",now+m-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... |