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