# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
466113 | 2021-08-18T01:28:51 Z | nehasane | Job Scheduling (CEOI12_jobs) | C++14 | 449 ms | 13732 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n, d, m; cin >> n >> d >> m; vector <pair<int, int>> jobs(m); for (int i = 0; i < m; i++){ cin >> jobs[i].first; jobs[i].second = i; } sort(begin(jobs), end(jobs)); int l = 1, r = m; while (l <= r){ int mid = (l+r) / 2; int day = 0, i = 0, start = 0; while (i < m){ for (i; i < min(m, start+mid); i++){ if (day > jobs[i].first + d){ start = INT_MAX; break; } } if (start == INT_MAX) break; else start = i; day++; } if (start == INT_MAX || day > n) l = mid + 1; else r = mid - 1; } cout << l << '\n'; int i = 0; for (int day = 0; day < n; day++){ int end = i + l; for (i; i < min(m, end); i++) cout << jobs[i].second + 1 << ' '; cout << 0 << '\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 42 ms | 1592 KB | Output isn't correct |
2 | Incorrect | 37 ms | 1600 KB | Output isn't correct |
3 | Incorrect | 39 ms | 1588 KB | Output isn't correct |
4 | Incorrect | 37 ms | 1592 KB | Output isn't correct |
5 | Incorrect | 37 ms | 1600 KB | Output isn't correct |
6 | Incorrect | 37 ms | 1584 KB | Output isn't correct |
7 | Incorrect | 36 ms | 1648 KB | Output isn't correct |
8 | Incorrect | 37 ms | 1588 KB | Output isn't correct |
9 | Incorrect | 56 ms | 1860 KB | Output isn't correct |
10 | Incorrect | 51 ms | 1836 KB | Output isn't correct |
11 | Incorrect | 52 ms | 1604 KB | Output isn't correct |
12 | Correct | 96 ms | 3140 KB | Output is correct |
13 | Incorrect | 147 ms | 4568 KB | Output isn't correct |
14 | Correct | 208 ms | 6096 KB | Output is correct |
15 | Incorrect | 239 ms | 7516 KB | Output isn't correct |
16 | Correct | 313 ms | 9088 KB | Output is correct |
17 | Incorrect | 359 ms | 10568 KB | Output isn't correct |
18 | Incorrect | 384 ms | 11968 KB | Output isn't correct |
19 | Incorrect | 449 ms | 13732 KB | Output isn't correct |
20 | Incorrect | 361 ms | 10512 KB | Output isn't correct |