// Hindeks
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
void fn()
{
// fstream myfile;
// myfile.open("inp.txt", ios::in);
int n;
cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; i++)
cin >> nums[i];
sort(nums.begin(), nums.end(), greater<int>());
int sol = 0;
for (int i = 0; i < n; i++)
{
if (nums[i] > i)
sol = i + 1;
else
break;
}
cout << sol << endl;
}
int main()
{
int t = 1;
// cin>>t;
while (t--)
fn();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
26 ms |
1200 KB |
Output is correct |
9 |
Correct |
149 ms |
5716 KB |
Output is correct |
10 |
Correct |
69 ms |
2936 KB |
Output is correct |