# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165707 | itiam | Hindeks (COCI17_hindeks) | C++11 | 1068 ms | 5752 KiB |
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 <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int L[500005];
int main(){
int N,x,zb,me=0;
cin >> N;
for (int i=0;i<N;i++){
cin >> x;
if (x<=500000) L[x]+=1;
else L[500000+1]+=1;
if (x>me) me=x;
}
if (me>=500000){
me=500001;
}
for (int i=me-1;i>0;i--){
zb=0;
for (int j=i;j<=me;j++){
zb+=L[j];
}
if (zb==i){
break;
}
}
cout << zb;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |