#include <bits/stdc++.h>
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N, D, M;
std::cin >> N >> D >> M;
std::vector<std::vector<int>> a(M, std::vector<int>(2));
for (int i = 0; i < M; ++i) {
std::cin >> a[i][0];
a[i][1] = i + 1;
}
sort(a.begin(), a.end());
int lo = 1, hi = M;
while (lo < hi) {
int mi = (lo + hi) / 2;
int task = 0;
bool ok = true;
for (int i = 1; i <= N && !ok; ++i) {
int cur = 0;
if (i > a[task][0] + D)
ok = false;
while (task < M && i >= a[task][0] && i <= a[task][0] + D && cur < mi) {
task++; cur++;
}
}
if (task == M && ok)
hi = mi;
else
lo = mi + 1;
}
std::cout << lo << "\n";
int task = 0;
for (int i = 1; i <= N; ++i) {
int cur = 0;
while (task < M && i >= a[task][0] && i <= a[task][0] + D && cur < lo) {
std::cout << a[task][1] << " ";
task++, cur++;
}
std::cout << 0 << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
6284 KB |
Output isn't correct |
2 |
Incorrect |
43 ms |
6300 KB |
Output isn't correct |
3 |
Incorrect |
31 ms |
6312 KB |
Output isn't correct |
4 |
Incorrect |
39 ms |
6308 KB |
Output isn't correct |
5 |
Incorrect |
41 ms |
6392 KB |
Output isn't correct |
6 |
Incorrect |
33 ms |
6316 KB |
Output isn't correct |
7 |
Incorrect |
35 ms |
6312 KB |
Output isn't correct |
8 |
Incorrect |
38 ms |
6324 KB |
Output isn't correct |
9 |
Incorrect |
55 ms |
6468 KB |
Output isn't correct |
10 |
Incorrect |
57 ms |
6512 KB |
Output isn't correct |
11 |
Incorrect |
54 ms |
6272 KB |
Output isn't correct |
12 |
Incorrect |
177 ms |
12560 KB |
Output isn't correct |
13 |
Incorrect |
213 ms |
18660 KB |
Output isn't correct |
14 |
Incorrect |
308 ms |
24864 KB |
Output isn't correct |
15 |
Incorrect |
390 ms |
31044 KB |
Output isn't correct |
16 |
Runtime error |
498 ms |
37288 KB |
Memory limit exceeded |
17 |
Runtime error |
592 ms |
43404 KB |
Memory limit exceeded |
18 |
Runtime error |
705 ms |
49748 KB |
Memory limit exceeded |
19 |
Runtime error |
790 ms |
55988 KB |
Memory limit exceeded |
20 |
Runtime error |
588 ms |
43412 KB |
Memory limit exceeded |