#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int cmp(int x, int y){
return x > y;
}
int main(){
int n;
cin >> n;
int sol = 0;
int all[n] = {0};
for(int i = 0; i < n; ++i){
cin >> all[i];
}
sort(all, all + n, cmp);
for(int i = 0; i < n; ++i){
if(all[i] < i + 1){
sol = i;
break;
}
}
cout << sol;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
252 KB |
Output is correct |
7 |
Correct |
7 ms |
376 KB |
Output is correct |
8 |
Correct |
62 ms |
1272 KB |
Output is correct |
9 |
Correct |
338 ms |
5756 KB |
Output is correct |
10 |
Incorrect |
169 ms |
3064 KB |
Output isn't correct |