#include <bits/stdc++.h>
#define GLHF ios_base::sync_with_stdio(0); cin.tie(), cout.tie();
#define GGWP return 0;
#define ALTF4 exit(0)
#define GCWS/*Good Contest, Well Solved*/ ALTF4
#define ull unsigned long long
#define ll long long
#define ld long double
#define fxr1(x) for(int I = 0; I < x; ++I)
#define fxr(x) for(int I = 0; I <= x; ++I)
#define F first
#define S second
using namespace std;
int n, a[500001], b[500001], ans;
int main()
{
GLHF
cin >> n;
for ( int I = 0; I < n; ++I )
cin >> a[I];
sort(a, a + n);
for ( int I = 0; I < n - 1; ++I )
for ( int J = I + 1; J < n; ++J )
{
if ( a[I] <= a[J] )
++b[I];
if ( a[I] <= b[I] )
ans = b[I];
}
cout << ans << endl;
GGWP
}
//clang++ -v -std=c++11 finish fishing the fish.people
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Correct |
2 ms |
408 KB |
Output is correct |
4 |
Correct |
2 ms |
456 KB |
Output is correct |
5 |
Correct |
2 ms |
456 KB |
Output is correct |
6 |
Correct |
3 ms |
456 KB |
Output is correct |
7 |
Correct |
56 ms |
456 KB |
Output is correct |
8 |
Execution timed out |
1064 ms |
1136 KB |
Time limit exceeded |
9 |
Execution timed out |
1071 ms |
2456 KB |
Time limit exceeded |
10 |
Execution timed out |
1074 ms |
2456 KB |
Time limit exceeded |