#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <array>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <list>
#include <float.h>
#include <climits>
using namespace std;
void quit() {
cout.flush();
exit(0);
}
long long n, d, m;
vector <pair<long long ,long long>> requests;
bool good(long long machines){
for(long long i = 0; i < m; i++){
if((i/machines+1)-requests[i].first>d){
return false;
}
}
return true;
}
int main(void){
//freopen("qwer.in", "r", stdin);
//freopen("qwer.out", "w", stdout);
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> d >> m;
requests.resize(m);
for(long long i = 0; i < m; i++){
cin >> requests[i].first;
requests[i].second = i+1;
}
sort(requests.begin(), requests.end());
long long s = 0, e = 1000000;
while(s!=e){
long long mid = (s+e)/2;
if(good(mid)){
e=mid;
}
else{
s=mid+1;
}
}
cout << e << "\n";
long long num_left = n;
for(long long i = 0; i < m; i+=e){
for(long long j = i; j < min(m, i+e); j++){
cout << requests[j].second << " ";
}
num_left--;
cout << "0\n";
}
for(long long i = 0; i < num_left; i++){
cout << "0\n";
}
quit();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
2756 KB |
Output isn't correct |
2 |
Incorrect |
33 ms |
2692 KB |
Output isn't correct |
3 |
Incorrect |
33 ms |
2680 KB |
Output isn't correct |
4 |
Incorrect |
34 ms |
2692 KB |
Output isn't correct |
5 |
Incorrect |
34 ms |
2692 KB |
Output isn't correct |
6 |
Incorrect |
33 ms |
2756 KB |
Output isn't correct |
7 |
Incorrect |
34 ms |
2748 KB |
Output isn't correct |
8 |
Incorrect |
35 ms |
2692 KB |
Output isn't correct |
9 |
Correct |
43 ms |
2904 KB |
Output is correct |
10 |
Correct |
43 ms |
2884 KB |
Output is correct |
11 |
Correct |
41 ms |
2756 KB |
Output is correct |
12 |
Correct |
83 ms |
5496 KB |
Output is correct |
13 |
Correct |
125 ms |
8132 KB |
Output is correct |
14 |
Correct |
174 ms |
11160 KB |
Output is correct |
15 |
Incorrect |
207 ms |
13380 KB |
Output isn't correct |
16 |
Correct |
244 ms |
16648 KB |
Output is correct |
17 |
Correct |
303 ms |
19344 KB |
Output is correct |
18 |
Correct |
330 ms |
21456 KB |
Output is correct |
19 |
Correct |
372 ms |
24116 KB |
Output is correct |
20 |
Correct |
309 ms |
19396 KB |
Output is correct |