#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ar array
const int INF = 1e15;
const int MOD = 1e9+7;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, d, m; cin>>n>>d>>m;
vector<ar<int,2>> a(m);
for (int i = 0; i < m; i++) {
cin>>a[i][0]; a[i][1] = i+1;
}
sort(a.begin(), a.end());
auto check = [&](int x) {
// if ((m+x-1)/x >= n) return false;
vector<int> time(x, 0);
for (int i = 0; i < m; i++) {
if (time[i % x] - a[i][0] > d) return false;
time[i % x] = a[i][0] + 1;
}
return true;
};
int lo = 0, hi = m, mid;
while (lo + 1 < hi) {
mid = (lo + hi)>>1;
if (check(mid)) hi = mid;
else lo = mid;
}
cout<<hi<<"\n";
for (int i = 0; i < m; i++) {
cout<<a[i][1]<<" ";
if ((i+1) % hi == 0) cout<<"0\n";
}
if (m % hi != 0) cout<<"0\n";
for (int i = (m+hi-1)/hi; i < n; i++) {
cout<<"0\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
41 ms |
2916 KB |
Output isn't correct |
2 |
Incorrect |
48 ms |
2916 KB |
Output isn't correct |
3 |
Incorrect |
39 ms |
2916 KB |
Output isn't correct |
4 |
Incorrect |
40 ms |
2936 KB |
Output isn't correct |
5 |
Incorrect |
39 ms |
2916 KB |
Output isn't correct |
6 |
Incorrect |
45 ms |
2916 KB |
Output isn't correct |
7 |
Incorrect |
40 ms |
2916 KB |
Output isn't correct |
8 |
Incorrect |
39 ms |
2916 KB |
Output isn't correct |
9 |
Incorrect |
46 ms |
2916 KB |
Output isn't correct |
10 |
Incorrect |
47 ms |
2916 KB |
Output isn't correct |
11 |
Incorrect |
48 ms |
2916 KB |
Output isn't correct |
12 |
Incorrect |
98 ms |
5620 KB |
Output isn't correct |
13 |
Incorrect |
149 ms |
8276 KB |
Output isn't correct |
14 |
Incorrect |
203 ms |
10956 KB |
Output isn't correct |
15 |
Incorrect |
256 ms |
13508 KB |
Output isn't correct |
16 |
Incorrect |
312 ms |
16188 KB |
Output isn't correct |
17 |
Incorrect |
366 ms |
18868 KB |
Output isn't correct |
18 |
Incorrect |
413 ms |
21552 KB |
Output isn't correct |
19 |
Incorrect |
472 ms |
24236 KB |
Output isn't correct |
20 |
Incorrect |
367 ms |
18868 KB |
Output isn't correct |