Submission #884385

#TimeUsernameProblemLanguageResultExecution timeMemory
884385AriadnaHindeks (COCI17_hindeks)C++14
50 / 50
140 ms2140 KiB

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector < int > a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int h = 0; 
    for (int i = n - 1; i >= 0; --i) {
        if (a[i] < h + 1) break;
        else ++h;
    }
    cout << h << '\n';
    
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...