#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n,a[500001],h,j=1,count_;
bool cmp(int a,int b)
{
return a>b;
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n,cmp);
for(int i=0;i<n;i++)
{
if(a[i]<i+1)
{
h=i;
break;
}
}
cout<<h;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
3 |
Correct |
2 ms |
440 KB |
Output is correct |
4 |
Correct |
2 ms |
500 KB |
Output is correct |
5 |
Correct |
2 ms |
500 KB |
Output is correct |
6 |
Correct |
2 ms |
500 KB |
Output is correct |
7 |
Correct |
7 ms |
672 KB |
Output is correct |
8 |
Correct |
54 ms |
1052 KB |
Output is correct |
9 |
Correct |
269 ms |
2548 KB |
Output is correct |
10 |
Incorrect |
141 ms |
2548 KB |
Output isn't correct |