#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
using namespace std;
int main() {
int n, d, m;
cin >> n >> d >> m;
vector<int> nums(n);
for (int i = 0; i < m; i++) {
int temp;
cin >> temp;
temp--;
nums[temp]++;
}
int lo = 0;
int hi = 1000005;
while (lo < hi) {
int mid = (lo + hi) / 2;
int counterCows = 0;
for (int i = 0; i < n - d; i++) {
counterCows += nums[i];
counterCows = max(counterCows - mid, 0);
}
if (counterCows == 0) {
hi = mid;
}
else {
lo = mid + 1;
}
}
cout << hi << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
640 KB |
Output isn't correct |
2 |
Incorrect |
27 ms |
640 KB |
Output isn't correct |
3 |
Incorrect |
28 ms |
640 KB |
Output isn't correct |
4 |
Incorrect |
27 ms |
640 KB |
Output isn't correct |
5 |
Incorrect |
30 ms |
768 KB |
Output isn't correct |
6 |
Incorrect |
27 ms |
640 KB |
Output isn't correct |
7 |
Incorrect |
29 ms |
640 KB |
Output isn't correct |
8 |
Incorrect |
28 ms |
640 KB |
Output isn't correct |
9 |
Incorrect |
27 ms |
1016 KB |
Output isn't correct |
10 |
Incorrect |
28 ms |
896 KB |
Output isn't correct |
11 |
Incorrect |
31 ms |
640 KB |
Output isn't correct |
12 |
Incorrect |
62 ms |
1016 KB |
Output isn't correct |
13 |
Incorrect |
93 ms |
1400 KB |
Output isn't correct |
14 |
Incorrect |
141 ms |
2424 KB |
Output isn't correct |
15 |
Incorrect |
151 ms |
2296 KB |
Output isn't correct |
16 |
Incorrect |
212 ms |
3192 KB |
Output isn't correct |
17 |
Incorrect |
258 ms |
3704 KB |
Output isn't correct |
18 |
Incorrect |
247 ms |
3448 KB |
Output isn't correct |
19 |
Incorrect |
278 ms |
4088 KB |
Output isn't correct |
20 |
Incorrect |
249 ms |
3704 KB |
Output isn't correct |