#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
int T, n, m, d;
vector <pair<int,int>> a;
bool check(int x){
int ind = -1, day = 0;
while(ind < m-1){
day++;
for(int i = ind+1; i <= min(ind+x,m-1); i++){
if(a[i].ss + d < day){
return false;
}
}
ind += x;
}
if(day > n) return false;
return true;
}
int main(){
cin >> n >> d >> m;
a.resize(m);
for(int i = 0; i < m; i++){
cin >> a[i].ff;
a[i].ss = i+1;
}
sort(a.begin(), a.end());
int l = 1, r = m, k = m;
while(l <= r){
int md = (l + r) / 2;
if(check(md)){
r = md-1;
k = md;
}
else {
l = md+1;
}
}
cout << k << '\n';
int ind = -1, cnt = 0;
while(ind < m-1){
cnt++;
for(int i = ind+1; i <= min(ind+k,m-1); i++){
cout << a[i].ss << " ";
}
ind += k;
cout << "0\n";
}
for(int i = cnt+1; i <= n; i++){
cout << "0\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
1608 KB |
Output isn't correct |
2 |
Incorrect |
27 ms |
2056 KB |
Output isn't correct |
3 |
Incorrect |
40 ms |
2024 KB |
Output isn't correct |
4 |
Incorrect |
39 ms |
1616 KB |
Output isn't correct |
5 |
Incorrect |
20 ms |
1872 KB |
Output isn't correct |
6 |
Incorrect |
21 ms |
1872 KB |
Output isn't correct |
7 |
Incorrect |
22 ms |
1872 KB |
Output isn't correct |
8 |
Incorrect |
21 ms |
1616 KB |
Output isn't correct |
9 |
Incorrect |
27 ms |
2036 KB |
Output isn't correct |
10 |
Incorrect |
27 ms |
1872 KB |
Output isn't correct |
11 |
Incorrect |
28 ms |
2120 KB |
Output isn't correct |
12 |
Incorrect |
59 ms |
3656 KB |
Output isn't correct |
13 |
Incorrect |
87 ms |
5448 KB |
Output isn't correct |
14 |
Incorrect |
124 ms |
6216 KB |
Output isn't correct |
15 |
Incorrect |
145 ms |
7496 KB |
Output isn't correct |
16 |
Incorrect |
191 ms |
10860 KB |
Output isn't correct |
17 |
Incorrect |
245 ms |
10568 KB |
Output isn't correct |
18 |
Incorrect |
227 ms |
13896 KB |
Output isn't correct |
19 |
Incorrect |
271 ms |
16548 KB |
Output isn't correct |
20 |
Incorrect |
219 ms |
12620 KB |
Output isn't correct |