# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733395 | 2023-04-30T16:18:36 Z | jared | Job Scheduling (CEOI12_jobs) | C++14 | 260 ms | 20652 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 | 19 ms | 2888 KB | Output isn't correct |
2 | Incorrect | 22 ms | 2884 KB | Output isn't correct |
3 | Incorrect | 19 ms | 2868 KB | Output isn't correct |
4 | Incorrect | 20 ms | 2828 KB | Output isn't correct |
5 | Incorrect | 19 ms | 2816 KB | Output isn't correct |
6 | Incorrect | 19 ms | 2888 KB | Output isn't correct |
7 | Incorrect | 19 ms | 2888 KB | Output isn't correct |
8 | Incorrect | 21 ms | 2904 KB | Output isn't correct |
9 | Incorrect | 26 ms | 2248 KB | Output isn't correct |
10 | Incorrect | 28 ms | 2264 KB | Output isn't correct |
11 | Incorrect | 30 ms | 2504 KB | Output isn't correct |
12 | Incorrect | 55 ms | 4732 KB | Output isn't correct |
13 | Incorrect | 84 ms | 6960 KB | Output isn't correct |
14 | Incorrect | 126 ms | 9980 KB | Output isn't correct |
15 | Incorrect | 138 ms | 11504 KB | Output isn't correct |
16 | Incorrect | 184 ms | 14636 KB | Output isn't correct |
17 | Incorrect | 222 ms | 17048 KB | Output isn't correct |
18 | Incorrect | 223 ms | 18240 KB | Output isn't correct |
19 | Incorrect | 260 ms | 20652 KB | Output isn't correct |
20 | Incorrect | 215 ms | 17068 KB | Output isn't correct |