Submission #377233

# Submission time Handle Problem Language Result Execution time Memory
377233 2021-03-13T13:49:35 Z marat0210 Hindeks (COCI17_hindeks) C++14
25 / 50
1000 ms 4204 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >>n;
    vector <long long> a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    for (int i = n - 1; i >= 0; --i) {
        long long cur = i + 1;
        long long cnt = 0;
        for (int j = 0; j < n; ++j) {
            if (a[j] >= cur) cnt++;
        }
        if (cnt == cur) {
            cout <<cur<<endl;
            return 0;
        }
    }
    cout <<0<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 0 ms 364 KB Output isn't correct
5 Correct 1 ms 364 KB Output is correct
6 Incorrect 2 ms 512 KB Output isn't correct
7 Correct 40 ms 364 KB Output is correct
8 Execution timed out 1038 ms 1132 KB Time limit exceeded
9 Execution timed out 1061 ms 4204 KB Time limit exceeded
10 Correct 84 ms 2284 KB Output is correct