Submission #153838

# Submission time Handle Problem Language Result Execution time Memory
153838 2019-09-16T19:29:49 Z mirceaishere Hindeks (COCI17_hindeks) C++14
45 / 50
293 ms 5752 KB
#include <iostream>
using namespace std;
int n, i, x, f[500002], v[500002];

int main(){
    cin>>n;
    for(i=1; i<=n; i++){
        cin>>x;
        if(x>n){
            x=n;
        }
        f[x]++;
    }
    for(i=n; i>=1; i--){
        f[i]+=f[i+1];
        if(f[i]>=i){
            cout<<i;
            return 0;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
8 Correct 53 ms 1252 KB Output is correct
9 Correct 293 ms 5752 KB Output is correct
10 Correct 144 ms 2040 KB Output is correct