# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831224 | 2023-08-20T00:18:32 Z | TimAni | Job Scheduling (CEOI12_jobs) | C++17 | 190 ms | 13756 KB |
#include <algorithm> #include <cassert> #include <cstdio> #include <iostream> #include <string> #include <vector> #include <set> #include <map> #include <numeric> #include <stack> #include <queue> #include <cmath> //#ifndef ONLINE_JUDGE //#include "/home/linux/Learning/headers/debug.h" //#else //#define debug(...) //#endif using namespace std; using ll = long long; void setIO(string File_name) { cin.tie(0)->sync_with_stdio(0); if (File_name.size()) { freopen((File_name + ".in").c_str(), "r", stdin); freopen((File_name + ".out").c_str(), "w", stdout); } } void sol() { int n, d, m; cin >> n >> d >> m; vector<pair<int, int>> v(m); for (int i = 0; i < m; i++) cin >> v[i].first, v[i].second = i + 1; sort(v.begin(), v.end()); auto good = [&](int mid) { int day = v[0].first; int free = mid; for (int i = 0; i < m;) { while (i < m && v[i].first <= day && free > 0) { if (day - v[i].first >= d) return false; i++; free--; } day++; free = mid; } return true; }; int l = 0, r = m; while (r - l > 1) { int mid = l + (r - l) / 2; if (good(mid)) r = mid; else l = mid; } cout << r << '\n'; int day = v[0].first; int free = r; for (int i = 0, j = 1; j <= n; j++) { while (i < m && v[i].first <= day && free > 0) { cout << v[i].second << ' '; i++; free--; } cout << "0 \n"; day++; free = r; } } int main() { setIO(""); int T = 1; //cin >> T; while (T--) sol(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 13 ms | 1748 KB | Output isn't correct |
2 | Incorrect | 19 ms | 1628 KB | Output isn't correct |
3 | Incorrect | 14 ms | 1632 KB | Output isn't correct |
4 | Incorrect | 14 ms | 1624 KB | Output isn't correct |
5 | Incorrect | 14 ms | 1620 KB | Output isn't correct |
6 | Incorrect | 13 ms | 1620 KB | Output isn't correct |
7 | Incorrect | 13 ms | 1632 KB | Output isn't correct |
8 | Incorrect | 13 ms | 1632 KB | Output isn't correct |
9 | Incorrect | 21 ms | 1980 KB | Output isn't correct |
10 | Incorrect | 21 ms | 2020 KB | Output isn't correct |
11 | Incorrect | 20 ms | 1668 KB | Expected EOLN |
12 | Incorrect | 41 ms | 3156 KB | Output isn't correct |
13 | Incorrect | 61 ms | 4592 KB | Expected EOLN |
14 | Incorrect | 87 ms | 6148 KB | Output isn't correct |
15 | Incorrect | 100 ms | 7628 KB | Output isn't correct |
16 | Incorrect | 139 ms | 9036 KB | Expected EOLN |
17 | Incorrect | 162 ms | 10532 KB | Expected EOLN |
18 | Incorrect | 168 ms | 12092 KB | Expected EOLN |
19 | Incorrect | 190 ms | 13756 KB | Output isn't correct |
20 | Incorrect | 150 ms | 10628 KB | Expected EOLN |