# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151299 | Linca_Robert | Hindeks (COCI17_hindeks) | C++14 | 0 ms | 0 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<bits/stdc++.h>
using namespace std;
int N, arr[500005];
int main(){
cin >> N;
for( int i = 1; i <= N; i++ )
cin >> arr[i];
sort( arr+ 1, arr + N + 1 );
for( int i = N; i >= 1; i-- ){
if( arr[i] < N - i + 1 ){
cout << N - i << endl;
return 0
}
}
cout << N << endl;
return 0;
}