#include<bits/stdc++.h>
using namespace std;
int N, arr[500005];
int main(){
cin >> N;
for( int i = 1; i <= N; i++ )
cin >> arr[i];
sort( arr+ 1, arr + N + 1 );
for( int i = N; i >= 1; i-- ){
if( arr[i] < N - i + 1 ){
cout << N - i << endl;
break;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 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 |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
400 KB |
Output is correct |
7 |
Correct |
7 ms |
376 KB |
Output is correct |
8 |
Correct |
60 ms |
1272 KB |
Output is correct |
9 |
Correct |
320 ms |
5728 KB |
Output is correct |
10 |
Incorrect |
162 ms |
3044 KB |
Output isn't correct |