# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160627 | 2019-10-29T01:28:18 Z | luciocf | Job Scheduling (CEOI12_jobs) | C++14 | 40 ms | 2216 KB |
#include <bits/stdc++.h> #define ff first #define ss second using namespace std; typedef pair<int, int> pii; const int maxn = 1e5+10; int n, d, m; pii a[maxn]; bool ok(int x) { int cur_d = 1; for (int i = 1; i <= m; i++) { int j = i; for (; j <= m && a[j].ff <= cur_d && j-i+1 <= x; j++) if (cur_d > a[j].ff+d) return 0; i = j-1; cur_d++; } return 1; } int busca(void) { int ini = 1, fim = m, ans = m; while (ini <= fim) { int mid = (ini+fim)>>1; if (ok(mid)) ans = mid, fim = mid-1; else ini = mid+1; } return ans; } int main(void) { scanf("%d %d %d", &n, &d, &m); for (int i = 1; i <= m; i++) { scanf("%d", &a[i].ff); a[i].ss = i; } sort(a+1, a+m+1); int ans = busca(); printf("%d\n", ans); int cur_d = 1, ind = 1; for (int i = 1; i <= n; i++) { int ant = ind; for (; ind <= m && a[ind].ff <= cur_d && ind-ant+1 <= ans; ind++) printf("%d ", a[ind].ss); printf("0\n"); cur_d++; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 2044 KB | Output is correct |
2 | Correct | 26 ms | 2044 KB | Output is correct |
3 | Correct | 26 ms | 2040 KB | Output is correct |
4 | Correct | 26 ms | 2040 KB | Output is correct |
5 | Correct | 27 ms | 2040 KB | Output is correct |
6 | Correct | 27 ms | 2040 KB | Output is correct |
7 | Correct | 26 ms | 2024 KB | Output is correct |
8 | Correct | 26 ms | 2028 KB | Output is correct |
9 | Correct | 38 ms | 2168 KB | Output is correct |
10 | Correct | 40 ms | 2216 KB | Output is correct |
11 | Correct | 38 ms | 2040 KB | Output is correct |
12 | Incorrect | 15 ms | 1704 KB | Output isn't correct |
13 | Incorrect | 15 ms | 1784 KB | Output isn't correct |
14 | Incorrect | 18 ms | 1784 KB | Output isn't correct |
15 | Incorrect | 15 ms | 1784 KB | Output isn't correct |
16 | Incorrect | 19 ms | 1824 KB | Output isn't correct |
17 | Incorrect | 17 ms | 1784 KB | Output isn't correct |
18 | Incorrect | 15 ms | 1724 KB | Output isn't correct |
19 | Incorrect | 21 ms | 1916 KB | Output isn't correct |
20 | Incorrect | 18 ms | 1784 KB | Output isn't correct |