#include <iostream>
#include <algorithm>
using namespace std;
int v[500010];
int n,i;
int main (){
cin>>n;
for (i=1;i<=n;i++)
cin>>v[i];
sort (v+1,v+n+1);
for (i=n;i;i--)
if (v[i] < n-i+1)
break;
cout<<n-i;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
376 KB |
Output is correct |
7 |
Correct |
8 ms |
376 KB |
Output is correct |
8 |
Correct |
62 ms |
1376 KB |
Output is correct |
9 |
Correct |
323 ms |
5616 KB |
Output is correct |
10 |
Correct |
161 ms |
3092 KB |
Output is correct |