#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
int h = 0;
while (h < n && a[n-1-h]>=h+1) {
h++;
}
cout << h << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
516 KB |
Output is correct |
4 |
Correct |
2 ms |
516 KB |
Output is correct |
5 |
Correct |
2 ms |
516 KB |
Output is correct |
6 |
Correct |
2 ms |
516 KB |
Output is correct |
7 |
Correct |
6 ms |
628 KB |
Output is correct |
8 |
Correct |
48 ms |
884 KB |
Output is correct |
9 |
Correct |
271 ms |
2484 KB |
Output is correct |
10 |
Correct |
127 ms |
2484 KB |
Output is correct |