#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >>n;
vector <int> a(n);
for (int i = 0; i < n; ++i) {
cin >>a[i];
}
for (int i = n - 1; i >= 0; --i) {
int cur = i + 1;
int cnt = 0;
for (int j = 0; j < n; ++j) {
if (a[j] >= cur) cnt++;
}
if (cnt == cur) {
cout <<cur<<endl;
return 0;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
512 KB |
Output isn't correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
7 |
Correct |
45 ms |
364 KB |
Output is correct |
8 |
Execution timed out |
1059 ms |
1260 KB |
Time limit exceeded |
9 |
Execution timed out |
1049 ms |
5612 KB |
Time limit exceeded |
10 |
Correct |
83 ms |
3072 KB |
Output is correct |