# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
512550 |
2022-01-16T12:59:54 Z |
Jean7 |
Hindeks (COCI17_hindeks) |
C++14 |
|
83 ms |
7532 KB |
#include <bits/stdc++.h>
#define fio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define int long long
using namespace std ;
signed main ()
{
fio ;
int n ;
cin >> n ;
int a[n] ;
for ( int i = 0 ; i < n ; i++ ) cin >> a[i] ;
sort ( a , a+n ) ;
int l = -1 , r = n+1 ;
while ( r-l > 1 )
{
int mid = (l+r) / 2 ;
auto it = &a[0] ;
int j = lower_bound( a , a+n , mid ) - it ;
j = n - j ;
if ( j >= mid ) l = mid ;
else r = mid ;
}
cout << l ;
return 0 ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
312 KB |
Output is correct |
7 |
Correct |
2 ms |
336 KB |
Output is correct |
8 |
Correct |
15 ms |
1660 KB |
Output is correct |
9 |
Correct |
83 ms |
7532 KB |
Output is correct |
10 |
Correct |
36 ms |
3908 KB |
Output is correct |