# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256280 | 2020-08-02T13:34:27 Z | Molukhyyeh | Job Scheduling (CEOI12_jobs) | C++14 | 382 ms | 22648 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define all(x) x.begin(),x.end() int const N = 200001, M = 1e6+1; int n, d, m; pair<int,int> v[M]; vector<int> pr[N]; bool ok(int md){ int av = md, day = 0, cur = 0; for(int i = 0; i<m; ++i){ cur = day; --av; if(!av)av = md, ++day; if(cur > v[i].first+d)return false; } return true; } int main(){ scanf("%d%d%d", &n, &d, &m); for(int i = 0; i<m; ++i){ scanf("%d", &v[i].first); v[i].second = i+1; } sort(v, v+m); int l = 1, r = m, md, an = m; while(l <= r){ md = l + r >> 1; if(ok(md))r = md-1, an = md; else l = md+1; } printf("%d\n", an); int day = 1, av = an, ls = 0; for(int i = 0; i<m; ++i){ pr[ls].push_back(v[i].second); --av; if(!av)av = md, ++day, ++ls; } for(int i = 0; i<n; ++i){ for(auto j: pr[i])printf("%d ", j); puts("0"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 7032 KB | Output isn't correct |
2 | Incorrect | 34 ms | 7032 KB | Output isn't correct |
3 | Incorrect | 31 ms | 6904 KB | Output isn't correct |
4 | Incorrect | 34 ms | 7032 KB | Output isn't correct |
5 | Incorrect | 30 ms | 6904 KB | Output isn't correct |
6 | Incorrect | 30 ms | 6912 KB | Output isn't correct |
7 | Incorrect | 49 ms | 7032 KB | Output isn't correct |
8 | Incorrect | 30 ms | 7032 KB | Output isn't correct |
9 | Incorrect | 40 ms | 7160 KB | Output isn't correct |
10 | Incorrect | 43 ms | 7032 KB | Output isn't correct |
11 | Incorrect | 45 ms | 6908 KB | Output isn't correct |
12 | Correct | 86 ms | 8952 KB | Output is correct |
13 | Incorrect | 127 ms | 11384 KB | Output isn't correct |
14 | Correct | 177 ms | 13560 KB | Output is correct |
15 | Incorrect | 206 ms | 14328 KB | Output isn't correct |
16 | Correct | 266 ms | 16504 KB | Output is correct |
17 | Incorrect | 307 ms | 20472 KB | Output isn't correct |
18 | Incorrect | 335 ms | 20856 KB | Output isn't correct |
19 | Incorrect | 382 ms | 22648 KB | Output isn't correct |
20 | Incorrect | 315 ms | 20472 KB | Output isn't correct |