#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n,a[500001],h;
bool flag=false;
bool cmp(int a,int b)
{
return a>b;
}
int main()
{
cin>>n;
h=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)
{
h=i;
flag=true;
break;
}
cout<<h;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
2 ms |
644 KB |
Output is correct |
5 |
Correct |
2 ms |
652 KB |
Output is correct |
6 |
Correct |
2 ms |
652 KB |
Output is correct |
7 |
Correct |
7 ms |
652 KB |
Output is correct |
8 |
Correct |
49 ms |
1740 KB |
Output is correct |
9 |
Correct |
303 ms |
6652 KB |
Output is correct |
10 |
Correct |
128 ms |
7452 KB |
Output is correct |