#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 <= m ; i ++ )
{
cin >> v[ i ] ;
v [ i ] += d ;
}
sort ( v + 1, v + m + 1) ;
long long poz = m ;
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 << '\n' ;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
1024 KB |
Output isn't correct |
2 |
Incorrect |
16 ms |
964 KB |
Output isn't correct |
3 |
Incorrect |
17 ms |
980 KB |
Output isn't correct |
4 |
Incorrect |
14 ms |
1008 KB |
Output isn't correct |
5 |
Incorrect |
13 ms |
980 KB |
Output isn't correct |
6 |
Incorrect |
15 ms |
1068 KB |
Output isn't correct |
7 |
Incorrect |
13 ms |
1088 KB |
Output isn't correct |
8 |
Incorrect |
13 ms |
980 KB |
Output isn't correct |
9 |
Incorrect |
14 ms |
980 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
14 ms |
980 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
19 ms |
1096 KB |
Output isn't correct |
12 |
Incorrect |
36 ms |
1840 KB |
Output isn't correct |
13 |
Incorrect |
54 ms |
2564 KB |
Output isn't correct |
14 |
Incorrect |
88 ms |
3312 KB |
Output isn't correct |
15 |
Incorrect |
92 ms |
4128 KB |
Output isn't correct |
16 |
Incorrect |
138 ms |
5032 KB |
Output isn't correct |
17 |
Incorrect |
154 ms |
5768 KB |
Output isn't correct |
18 |
Incorrect |
144 ms |
6456 KB |
Output isn't correct |
19 |
Incorrect |
178 ms |
7388 KB |
Output isn't correct |
20 |
Incorrect |
155 ms |
5764 KB |
Output isn't correct |