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>
#define min(X,Y)(X<Y?X:Y)
int i,n,m,c,a[50005],d[2000005];
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(!d[a[i]+1000000]) {
d[a[i]+1000000]=1;
c++;
}
}
scanf("%d",&m);
if(m<=n){printf("%d",a[m-1]);return 0;}
m=c+m-n-1;
for(i=0;i<n;i++) {
if(a[i]>=c && a[i]<=m) {
m=min(a[i],m);
}
}
printf("%d",m);
}
# | 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... |