답안 #377245

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
377245 2021-03-13T14:19:13 Z marat0210 Hindeks (COCI17_hindeks) C++14
5 / 50
257 ms 4588 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];
    }
    sort(a.begin(), a.end());
    for (int i = n; i >= 0; --i) {
        int cnt = (upper_bound(a.begin(), a.end(), i) - a.begin()) - (lower_bound(a.begin(), a.end(), i - 1) - a.begin());
        if (cnt >= i) {
            cout <<i<<endl;
            return 0;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Incorrect 1 ms 364 KB Output isn't correct
7 Incorrect 6 ms 364 KB Output isn't correct
8 Incorrect 47 ms 1132 KB Output isn't correct
9 Incorrect 257 ms 4588 KB Output isn't correct
10 Incorrect 112 ms 2284 KB Output isn't correct