# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256316 | 2020-08-02T14:15:57 Z | Molukhyyeh | Job Scheduling (CEOI12_jobs) | C++14 | 313 ms | 19576 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))r = md-1, an = md; else l = md+1; } printf("%d\n", an); int day = 0, av = an, ls = 0; for(int i = 0; i<m; ++i){ printf("%d ", v[i].second); --av; if(!av)av = md, printf("0\n"), ++day; } for(int i = 0; i<n-day; ++i)puts("0"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 28 ms | 6776 KB | Output isn't correct |
2 | Incorrect | 40 ms | 6648 KB | Output isn't correct |
3 | Incorrect | 31 ms | 6780 KB | Output isn't correct |
4 | Incorrect | 27 ms | 6652 KB | Output isn't correct |
5 | Incorrect | 26 ms | 6656 KB | Output isn't correct |
6 | Incorrect | 28 ms | 6776 KB | Output isn't correct |
7 | Incorrect | 28 ms | 6648 KB | Output isn't correct |
8 | Incorrect | 37 ms | 6776 KB | Output isn't correct |
9 | Correct | 38 ms | 6904 KB | Output is correct |
10 | Partially correct | 57 ms | 6904 KB | Partially correct |
11 | Correct | 52 ms | 6776 KB | Output is correct |
12 | Correct | 100 ms | 8696 KB | Output is correct |
13 | Correct | 108 ms | 10104 KB | Output is correct |
14 | Correct | 147 ms | 11640 KB | Output is correct |
15 | Incorrect | 176 ms | 13048 KB | Output isn't correct |
16 | Correct | 223 ms | 14716 KB | Output is correct |
17 | Correct | 262 ms | 16332 KB | Output is correct |
18 | Partially correct | 289 ms | 17804 KB | Partially correct |
19 | Correct | 313 ms | 19576 KB | Output is correct |
20 | Correct | 259 ms | 16376 KB | Output is correct |