#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>> n;
vector<int>v(n);
for (int i = 0; i < n; ++i)cin>> v[i];
sort(v.begin(), v.end());
for (int i = 1; i <= n; ++i){
if (v[n-i] < i){
cout<< i-1 << '\n';
return 0;
}
}
cout<< n << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
25 ms |
820 KB |
Output is correct |
9 |
Correct |
157 ms |
2396 KB |
Output is correct |
10 |
Correct |
68 ms |
1400 KB |
Output is correct |