#include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define ll long long
#define ull unsigned long long
#define f first
#define s second
#define PF push_front
#define PB push_back
#define MP make_pair
#define max(a, b) ((a > b)? a : b)
#define min(a, b) ((a < b)? a : b)
#define max3(a, b, c) max(max(a, b), c)
#define min3(a, b, c) min(min(a, b), c)
const int N = 1e6 + 5;
const int M = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const ll int INF = 1e18;
int bin(int l, int r, function<bool(int)> f){
while(l < r){
int mid = l + (r - l)/2;
if(f(mid)){
r = mid;
}else {
l = mid + 1;
}
}
return l;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
// ifstream cin();
// ofstream cout();
vector<pair<int, int>> v;
int n, d, m, a;
cin >> n >> d >> m;
for(int i = 0; i < m; i++){
cin >> a;
v.PB(MP(a, i+1));
}
sort(v.begin(), v.end());
vector<vector<int>> ans;
int mac = bin(1, m, [&](int x){
cout << "NOW " << x << endl;
vector<vector<int>> cur_ans;
bool valid = true;
int tot = 0;
for(int day = 1, i = 0; day <= n && i < m; day++){
int cnt = 0;
vector<int> cur;
while(i < m && cnt < x && v[i].f <= day){
if(day - d > v[i].f) valid = false;
cur.PB(v[i].s);
cnt++;
i++;
}
tot += cur.size();
cur_ans.PB(cur);
}
if(valid && tot == m) ans = cur_ans;
return (valid && tot == m);
});
cout << mac << endl;
for(int i = 0; i < n; i++){
if(i < ans.size()){
for(int j : ans[i]){
cout << j << ' ';
}
}
cout << 0 << endl;
}
}
Compilation message
jobs.cpp: In function 'int main()':
jobs.cpp:89:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
89 | if(i < ans.size()){
| ~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
3032 KB |
Expected integer, but "NOW" found |
2 |
Incorrect |
27 ms |
3032 KB |
Expected integer, but "NOW" found |
3 |
Incorrect |
27 ms |
3180 KB |
Expected integer, but "NOW" found |
4 |
Incorrect |
30 ms |
3028 KB |
Expected integer, but "NOW" found |
5 |
Incorrect |
27 ms |
3028 KB |
Expected integer, but "NOW" found |
6 |
Incorrect |
27 ms |
3032 KB |
Expected integer, but "NOW" found |
7 |
Incorrect |
32 ms |
3276 KB |
Expected integer, but "NOW" found |
8 |
Incorrect |
27 ms |
3284 KB |
Expected integer, but "NOW" found |
9 |
Incorrect |
120 ms |
3352 KB |
Expected integer, but "NOW" found |
10 |
Incorrect |
126 ms |
3280 KB |
Expected integer, but "NOW" found |
11 |
Incorrect |
26 ms |
3544 KB |
Expected integer, but "NOW" found |
12 |
Incorrect |
49 ms |
6568 KB |
Expected integer, but "NOW" found |
13 |
Incorrect |
72 ms |
10428 KB |
Expected integer, but "NOW" found |
14 |
Incorrect |
130 ms |
14084 KB |
Expected integer, but "NOW" found |
15 |
Incorrect |
118 ms |
15640 KB |
Expected integer, but "NOW" found |
16 |
Incorrect |
182 ms |
21756 KB |
Expected integer, but "NOW" found |
17 |
Incorrect |
208 ms |
23732 KB |
Expected integer, but "NOW" found |
18 |
Incorrect |
199 ms |
26296 KB |
Expected integer, but "NOW" found |
19 |
Incorrect |
309 ms |
28340 KB |
Expected integer, but "NOW" found |
20 |
Incorrect |
208 ms |
24500 KB |
Expected integer, but "NOW" found |