# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165716 | itiam | Hindeks (COCI17_hindeks) | C++11 | 305 ms | 2312 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=0,me=0,br=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;
}
/*cout << "L: ";
for (int i=0;i<=me;i++) cout << L[i] << " ";
cout << "\n";
*/
for (int i=me;i>=0;i--){
for (int j=i;j<=me-br;j++){
zb+=L[j];
}
//cout << "zb: " << zb << "\n";
br+=1;
if (zb>=i){
zb=i;
break;
}
}
cout << zb;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |