# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256309 | 2020-08-02T14:06:02 Z | Molukhyyeh | Job Scheduling (CEOI12_jobs) | C++14 | 341 ms | 23004 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){ if(m / md > n)return false; 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 = m/n+(m%n? 1: 0), r = M, md, an = m; while(l <= r){ md = l + r >> 1; if(ok(md)){ if(m%md == 0)r = md-1, an = md; else r = md-1; } 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 | 28 ms | 7280 KB | Output isn't correct |
2 | Incorrect | 37 ms | 7288 KB | Output isn't correct |
3 | Incorrect | 27 ms | 7280 KB | Output isn't correct |
4 | Incorrect | 29 ms | 7288 KB | Output isn't correct |
5 | Incorrect | 28 ms | 7280 KB | Output isn't correct |
6 | Incorrect | 28 ms | 7280 KB | Output isn't correct |
7 | Incorrect | 36 ms | 7280 KB | Output isn't correct |
8 | Incorrect | 39 ms | 7280 KB | Output isn't correct |
9 | Incorrect | 55 ms | 7408 KB | Output isn't correct |
10 | Incorrect | 39 ms | 7412 KB | Output isn't correct |
11 | Incorrect | 40 ms | 7288 KB | Output isn't correct |
12 | Correct | 78 ms | 9208 KB | Output is correct |
13 | Incorrect | 113 ms | 11108 KB | Output isn't correct |
14 | Correct | 162 ms | 13944 KB | Output is correct |
15 | Incorrect | 182 ms | 14820 KB | Output isn't correct |
16 | Incorrect | 253 ms | 17400 KB | Output isn't correct |
17 | Incorrect | 313 ms | 18996 KB | Output isn't correct |
18 | Incorrect | 304 ms | 20872 KB | Output isn't correct |
19 | Incorrect | 341 ms | 23004 KB | Output isn't correct |
20 | Incorrect | 290 ms | 19020 KB | Output isn't correct |