#pragma GCC optimize("unroll-loops, O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
using namespace std;
int n, q, m;
pair<int, int> a[1000001];
vector<vector<int>> check(int cnt){
vector<vector<int>> res;
int k = 1;
for(int i = 1; i <= n; i++){
res.push_back({});
for(int j = 0; j < cnt && k <= m; j++, k++)
if(a[k].first + q < i) return {};
else res.back().push_back(a[k].second);
}
if(k <= m) return {};
else return res;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> q >> m;
for(int i = 1; i <= m; i++)
cin >> a[i].first, a[i].second = i;
sort(a, a + m + 1);
int l = 1, r = 1e6;
vector<vector<int>> ans;
while(l < r){
int mid = l + (r - l) / 2;
vector<vector<int>> work = check(mid);
if(!work.empty()) ans = work, r = mid;
else l = mid + 1;
}
cout << r << '\n';
for(auto &i : ans){
for(int j : i) cout << j << ' ';
cout << "0\n";
}
return 0;
}
Compilation message
jobs.cpp:1:40: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
1 | #pragma GCC optimize("unroll-loops, O3")
| ^
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
2 | #pragma GCC target("avx")
| ^
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
jobs.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
/var
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
4872 KB |
Output isn't correct |
2 |
Incorrect |
31 ms |
4872 KB |
Output isn't correct |
3 |
Incorrect |
32 ms |
4744 KB |
Output isn't correct |
4 |
Incorrect |
32 ms |
5000 KB |
Output isn't correct |
5 |
Incorrect |
33 ms |
5124 KB |
Output isn't correct |
6 |
Incorrect |
32 ms |
4872 KB |
Output isn't correct |
7 |
Incorrect |
32 ms |
5128 KB |
Output isn't correct |
8 |
Incorrect |
34 ms |
5252 KB |
Output isn't correct |
9 |
Correct |
72 ms |
11152 KB |
Output is correct |
10 |
Correct |
88 ms |
11256 KB |
Output is correct |
11 |
Correct |
39 ms |
5004 KB |
Output is correct |
12 |
Correct |
78 ms |
9696 KB |
Output is correct |
13 |
Correct |
117 ms |
15048 KB |
Output is correct |
14 |
Correct |
179 ms |
23364 KB |
Output is correct |
15 |
Incorrect |
196 ms |
25404 KB |
Output isn't correct |
16 |
Correct |
246 ms |
32444 KB |
Output is correct |
17 |
Runtime error |
310 ms |
39868 KB |
Memory limit exceeded |
18 |
Runtime error |
313 ms |
37412 KB |
Memory limit exceeded |
19 |
Runtime error |
385 ms |
42888 KB |
Memory limit exceeded |
20 |
Runtime error |
310 ms |
39740 KB |
Memory limit exceeded |