제출 #377230

#제출 시각아이디문제언어결과실행 시간메모리
377230marat0210Hindeks (COCI17_hindeks)C++14
20 / 50
1059 ms5612 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];
    }
    for (int i = n - 1; i >= 0; --i) {
        int cur = i + 1;
        int cnt = 0;
        for (int j = 0; j < n; ++j) {
            if (a[j] >= cur) cnt++;
        }
        if (cnt == cur) {
            cout <<cur<<endl;
            return 0;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...