#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
sort(arr,arr+n);
int h=0;
for(int i=n-1;i>-1;i--){
if(arr[i]>=n-i)h=n-i;
}cout<<h<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
360 KB |
Output is correct |
3 |
Correct |
3 ms |
472 KB |
Output is correct |
4 |
Correct |
3 ms |
592 KB |
Output is correct |
5 |
Correct |
3 ms |
596 KB |
Output is correct |
6 |
Correct |
4 ms |
596 KB |
Output is correct |
7 |
Correct |
8 ms |
708 KB |
Output is correct |
8 |
Correct |
46 ms |
1704 KB |
Output is correct |
9 |
Correct |
266 ms |
6744 KB |
Output is correct |
10 |
Correct |
134 ms |
7476 KB |
Output is correct |