#include <bits/stdc++.h>
using namespace std;
const int DIM = 500005;
int arr[DIM];
int main(void) {
int n;
cin >> n;
for (int i = 1; i <= n; ++i)
cin >> arr[i];
sort(arr + 1, arr + n + 1);
int i = 1;
while (i <= n && arr[i] < n - i + 1)
++i;
cout << n - i + 1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
61 ms |
1412 KB |
Output is correct |
9 |
Correct |
325 ms |
5660 KB |
Output is correct |
10 |
Correct |
163 ms |
2936 KB |
Output is correct |