#include <bits/stdc++.h>
using namespace std;
long long n, d, m ;
long long v [ 1000005 ];
bool check(int caz )
{
int ziua = 1 ;
for ( int i = 1; i <= n ; i += caz, ziua ++ )
{
if ( v[ i ] <= ziua )
return false ;
}
return true ;
}
int main()
{
cin >> n >> d >> m ;
for ( int i = 1; i <= n ; i ++ )
{
cin >> v[ i ] ;
v [ i ] += d ;
}
sort ( v + 1, v +n + 1) ;
long long poz = 1e9 ;
int st = 1, dr = m ;
while ( st <= dr )
{
long long mij = ( st + dr ) / 2 ;
if ( check ( mij ) == true )
{
poz = mij ;
dr = mij - 1;
}
else
st = mij + 1;
}
cout << poz ;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
452 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
452 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
9 |
Incorrect |
15 ms |
1276 KB |
Output isn't correct |
10 |
Incorrect |
15 ms |
1316 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
568 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
596 KB |
Output isn't correct |
17 |
Incorrect |
3 ms |
572 KB |
Output isn't correct |
18 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
19 |
Incorrect |
19 ms |
1620 KB |
Output isn't correct |
20 |
Incorrect |
3 ms |
596 KB |
Output isn't correct |