# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733398 | 2023-04-30T16:20:42 Z | jared | Job Scheduling (CEOI12_jobs) | C++14 | 283 ms | 17136 KB |
#include <bits/stdc++.h> #ifdef LOCAL_TEST #include "debugging.h" #endif using namespace std; void setio(string filename) { ios::sync_with_stdio(false); cin.tie(nullptr); if (getenv("stdio")) filename = ""; else if (getenv("local_test")) filename = "test"; if (!filename.empty()) { freopen((filename + ".in").c_str(), "r", stdin); freopen((filename + ".out").c_str(), "w", stdout); } } vector<vector<int>> days; bool ok(vector<pair<int, int>> &x, int n, int d, int target, bool out) { int ptr = 0; for (int day = 1; day <= n; day++) { vector<int> v; int daily_cnt = target; while (daily_cnt--) { if (x[ptr].first > day) break; if (day - x[ptr].first > d) return false; if (out) v.push_back(x[ptr].second); ptr++; } if (out) days.push_back(v); } return ptr >= x.size(); } int main() { setio(""); int n, d, m; cin >> n >> d >> m; vector<pair<int, int>> x; for (int i = 1; i <= m; i++) { int tmp; cin >> tmp; x.emplace_back(tmp, i); } sort(x.begin(), x.end()); int l = 1, r = m; while (l < r) { int mid = l + (r - l) / 2; days.clear(); if (ok(x, n, d, mid, false)) r = mid; else l = mid + 1; } cout << l << endl; ok(x, n, d, l, true); for (auto &day: days) { for (int id: day) cout << id << ' '; cout << 0 << endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 28 ms | 2516 KB | Output isn't correct |
2 | Incorrect | 28 ms | 2484 KB | Output isn't correct |
3 | Incorrect | 22 ms | 2620 KB | Output isn't correct |
4 | Incorrect | 27 ms | 2496 KB | Output isn't correct |
5 | Incorrect | 22 ms | 2560 KB | Output isn't correct |
6 | Incorrect | 22 ms | 2504 KB | Output isn't correct |
7 | Incorrect | 25 ms | 2588 KB | Output isn't correct |
8 | Incorrect | 24 ms | 2544 KB | Output isn't correct |
9 | Incorrect | 26 ms | 2012 KB | Output isn't correct |
10 | Incorrect | 32 ms | 2052 KB | Output isn't correct |
11 | Incorrect | 37 ms | 2000 KB | Output isn't correct |
12 | Incorrect | 78 ms | 3932 KB | Output isn't correct |
13 | Incorrect | 113 ms | 5816 KB | Output isn't correct |
14 | Incorrect | 137 ms | 8112 KB | Output isn't correct |
15 | Incorrect | 156 ms | 9568 KB | Output isn't correct |
16 | Incorrect | 180 ms | 11868 KB | Output isn't correct |
17 | Incorrect | 218 ms | 13744 KB | Output isn't correct |
18 | Incorrect | 253 ms | 15212 KB | Output isn't correct |
19 | Incorrect | 283 ms | 17136 KB | Output isn't correct |
20 | Incorrect | 222 ms | 13740 KB | Output isn't correct |