#include <bits/stdc++.h>
using namespace std;
#define _for(i, a, b) for(LL i = (a); i < (b); ++i)
const int NN = 1e5 + 4;
using LL = long long;
int N, D, M, T[NN];
bool check(LL x){
int q = 0;
_for(i, 1, N - D + 1){
if((q += T[i]) > x * (D + 1)) return 0;
q = max(q - x, 0LL);
}
return 1;
}
int main(){
ios::sync_with_stdio(false), cin.tie(0);
cin >> N >> D >> M;
int r = M;
_for(i, 0, M) cin >> r, T[r]++;
for(int l = 1, m; l + 1 < r;) m = (l + r) / 2, (check(m) ? r : l) = m;
return printf("%d\n", r), 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
728 KB |
Output isn't correct |
2 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
3 |
Incorrect |
4 ms |
732 KB |
Output isn't correct |
4 |
Incorrect |
5 ms |
604 KB |
Output isn't correct |
5 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
6 |
Incorrect |
5 ms |
604 KB |
Output isn't correct |
7 |
Incorrect |
5 ms |
576 KB |
Output isn't correct |
8 |
Incorrect |
5 ms |
604 KB |
Output isn't correct |
9 |
Incorrect |
6 ms |
604 KB |
Output isn't correct |
10 |
Incorrect |
5 ms |
856 KB |
Output isn't correct |
11 |
Incorrect |
5 ms |
856 KB |
Output isn't correct |
12 |
Incorrect |
10 ms |
1092 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
14 ms |
1344 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
25 ms |
2388 KB |
Unexpected end of file - int32 expected |
15 |
Incorrect |
24 ms |
1876 KB |
Output isn't correct |
16 |
Incorrect |
31 ms |
2896 KB |
Unexpected end of file - int32 expected |
17 |
Incorrect |
37 ms |
3412 KB |
Unexpected end of file - int32 expected |
18 |
Incorrect |
38 ms |
2900 KB |
Output isn't correct |
19 |
Incorrect |
43 ms |
3256 KB |
Output isn't correct |
20 |
Incorrect |
37 ms |
3128 KB |
Unexpected end of file - int32 expected |