답안 #884385

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
884385 2023-12-07T09:17:30 Z Ariadna Hindeks (COCI17_hindeks) C++14
50 / 50
140 ms 2140 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 26 ms 836 KB Output is correct
9 Correct 140 ms 2140 KB Output is correct
10 Correct 70 ms 1368 KB Output is correct