Submission #891711

# Submission time Handle Problem Language Result Execution time Memory
891711 2023-12-23T17:11:34 Z ind1v Hindeks (COCI17_hindeks) C++11
50 / 50
71 ms 7668 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

const int N = 5e5 + 4;

int a[N];
int n, h;

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1, greater<int>());
  for (int i = 1; i <= n; ++i) {
    if (a[i] >= i) {
      h = i;
    }
  }
  cout << h;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 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 1 ms 480 KB Output is correct
8 Correct 13 ms 3164 KB Output is correct
9 Correct 71 ms 7668 KB Output is correct
10 Correct 32 ms 4188 KB Output is correct