답안 #247893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247893 2020-07-12T06:16:04 Z NONAME Hindeks (COCI17_hindeks) C++14
50 / 50
104 ms 2468 KB
#include <bits/stdc++.h>
#define dbg(x) cerr << #x << " = " << x << "\n"
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie()
using namespace std;
using ll = long long;

int n, a[int(5e5) + 100];

int main() {
    fast_io;

    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    sort(a, a + n);
    reverse(a, a + n);
    int p = -1;
    for (int i = 0; i < n; ++i)
        if (a[i] >= i + 1)
            p = i;
    cout << p + 1 << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 19 ms 768 KB Output is correct
9 Correct 104 ms 2468 KB Output is correct
10 Correct 49 ms 1272 KB Output is correct