#include <iostream>
#include <algorithm>
using namespace std;
int n,v[500100];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>v[i];
}
sort(v+1,v+n+1);
for(int i=n;i>=0;i--){
if(n-i+1>v[i]){
cout<<n-i;
return 0;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 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 |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
7 ms |
376 KB |
Output is correct |
8 |
Correct |
59 ms |
1272 KB |
Output is correct |
9 |
Correct |
322 ms |
3060 KB |
Output is correct |
10 |
Correct |
168 ms |
2040 KB |
Output is correct |