#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, d, m;
cin >> n >> d >> m;
vector<int> v (n+1, 0), sp (n+1, 0);
vector<vector<int>> c (n+1);
for (int i = 1; i < m+1; i++) {
int x;
cin >> x;
v[x]++;
c[x].push_back(i);
}
vector<int> s;
for (auto i : c) {
for (int x : i) {
s.push_back(x);
}
}
for (int i = 1; i < n+1; i++) {
sp[i] = sp[i-1]+v[i];
}
int p = 0, j = 1<<20;
while (j > 0) {
int k = p+j;
int wyk = 0;
bool b = 1;
for (int i = 1; i < n+1; i++) {
wyk = min(wyk+k, sp[i]);
if (i > d+1 && wyk < sp[i-d-1]) {
b = 0;
break;
}
}
if (!b) {
p += j;
}
j /= 2;
}
cout << p+1 << '\n';
int k = p+1, nr = 0;
int wyk = 0;
for (int i = 1; i < n+1; i++) {
wyk = min(wyk+k, sp[i]);
while (nr < wyk) {
cout << s[nr] << ' ';
nr++;
}
//cout << "0\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
2516 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
2516 KB |
Output isn't correct |
3 |
Incorrect |
11 ms |
2516 KB |
Output isn't correct |
4 |
Incorrect |
11 ms |
2516 KB |
Output isn't correct |
5 |
Incorrect |
11 ms |
2516 KB |
Output isn't correct |
6 |
Incorrect |
11 ms |
2616 KB |
Output isn't correct |
7 |
Incorrect |
12 ms |
2636 KB |
Output isn't correct |
8 |
Incorrect |
11 ms |
2516 KB |
Output isn't correct |
9 |
Incorrect |
14 ms |
5624 KB |
Output isn't correct |
10 |
Incorrect |
13 ms |
5600 KB |
Output isn't correct |
11 |
Incorrect |
11 ms |
2512 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
21 ms |
4308 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
32 ms |
7044 KB |
Output isn't correct |
14 |
Incorrect |
52 ms |
9548 KB |
Unexpected end of file - int32 expected |
15 |
Incorrect |
51 ms |
10940 KB |
Output isn't correct |
16 |
Incorrect |
82 ms |
14136 KB |
Unexpected end of file - int32 expected |
17 |
Incorrect |
93 ms |
16868 KB |
Output isn't correct |
18 |
Incorrect |
86 ms |
17084 KB |
Output isn't correct |
19 |
Incorrect |
105 ms |
21180 KB |
Output isn't correct |
20 |
Incorrect |
91 ms |
16824 KB |
Output isn't correct |