#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
vector<int>papers(n);
for (int i=0; i<n; i++) cin>>papers[i];
sort(papers.begin(), papers.end());
for (int k=0; k<n; k++){
if (papers[k]>=n-k){
cout<<n-k<<endl;
return 0;
}
}cout<<0<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
26 ms |
832 KB |
Output is correct |
9 |
Correct |
141 ms |
2392 KB |
Output is correct |
10 |
Correct |
68 ms |
1404 KB |
Output is correct |