# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733413 | 2023-04-30T16:40:18 Z | jared | Job Scheduling (CEOI12_jobs) | C++14 | 355 ms | 20140 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++) { if (ptr >= x.size()) break; int daily_cnt = target; while (daily_cnt--) { if (x[ptr].first > day) break; if (day - x[ptr].first >= d) return false; if (out) days[day - 1].push_back(x[ptr].second); ptr++; } } 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; if (ok(x, n, d, mid, false)) r = mid; else l = mid + 1; } cout << l << endl; days.resize(n); 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 | 29 ms | 2768 KB | Output isn't correct |
2 | Incorrect | 29 ms | 2824 KB | Output isn't correct |
3 | Incorrect | 29 ms | 2812 KB | Output isn't correct |
4 | Incorrect | 30 ms | 2960 KB | Output isn't correct |
5 | Incorrect | 30 ms | 2768 KB | Output isn't correct |
6 | Incorrect | 29 ms | 2788 KB | Output isn't correct |
7 | Incorrect | 30 ms | 2792 KB | Output isn't correct |
8 | Incorrect | 32 ms | 2840 KB | Output isn't correct |
9 | Incorrect | 141 ms | 4852 KB | Output isn't correct |
10 | Incorrect | 151 ms | 4720 KB | Output isn't correct |
11 | Incorrect | 28 ms | 2136 KB | Output isn't correct |
12 | Incorrect | 55 ms | 4032 KB | Output isn't correct |
13 | Incorrect | 84 ms | 6704 KB | Output isn't correct |
14 | Incorrect | 123 ms | 8760 KB | Output isn't correct |
15 | Incorrect | 138 ms | 10168 KB | Output isn't correct |
16 | Incorrect | 178 ms | 12692 KB | Output isn't correct |
17 | Incorrect | 209 ms | 15436 KB | Output isn't correct |
18 | Incorrect | 224 ms | 16316 KB | Output isn't correct |
19 | Incorrect | 355 ms | 20140 KB | Output isn't correct |
20 | Incorrect | 211 ms | 15404 KB | Output isn't correct |