Submission #891711

#TimeUsernameProblemLanguageResultExecution timeMemory
891711ind1vHindeks (COCI17_hindeks)C++11
50 / 50
71 ms7668 KiB
#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 timeMemoryGrader output
Fetching results...