# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1051853 | 2024-08-10T10:13:02 Z | manhlinh1501 | Job Scheduling (CEOI12_jobs) | C++17 | 123 ms | 41556 KB |
#include <bits/stdc++.h> using namespace std; using i64 = long long; using pii = pair<int, int>; const int MAXN = 1e6 + 5; int N, M, D; int a[MAXN]; vector<int> g[MAXN]; bool check(int K) { queue<int> Q; for(int i = 0; i <= N; i++) { for(int p : g[i]) Q.emplace(p); int cnt = 0; while(!Q.empty() and cnt < K) { int p = Q.front(); if(i - D > a[p]) return false; Q.pop(); cnt++; } } return Q.empty(); } signed main() { #define TASK "code" if (fopen(TASK ".inp", "r")) { freopen(TASK ".inp", "r", stdin); freopen(TASK ".out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> D >> M; for(int i = 1; i <= M; i++) cin >> a[i]; for(int i = 1; i <= M; i++) g[a[i]].emplace_back(i); int low = 1, high = M; int ans = -1; while(low <= high) { int mid = (low + high) / 2; if(check(mid)) { ans = mid; high = mid - 1; } else low = mid + 1; } cout << ans << "\n"; queue<int> Q; for(int i = 0; i <= N; i++) { for(int p : g[i]) Q.emplace(p); int cnt = 0; while(!Q.empty() and cnt < ans) { int p = Q.front(); cout << p << " "; Q.pop(); cnt++; } cout << "0\n"; } return (0 ^ 0); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 26852 KB | Extra information in the output file |
2 | Incorrect | 14 ms | 26844 KB | Extra information in the output file |
3 | Incorrect | 24 ms | 26836 KB | Extra information in the output file |
4 | Incorrect | 16 ms | 26844 KB | Extra information in the output file |
5 | Incorrect | 15 ms | 26844 KB | Extra information in the output file |
6 | Incorrect | 15 ms | 26892 KB | Extra information in the output file |
7 | Incorrect | 16 ms | 26844 KB | Extra information in the output file |
8 | Incorrect | 14 ms | 26896 KB | Extra information in the output file |
9 | Incorrect | 19 ms | 26788 KB | Extra information in the output file |
10 | Incorrect | 22 ms | 26960 KB | Extra information in the output file |
11 | Incorrect | 16 ms | 26716 KB | Extra information in the output file |
12 | Incorrect | 29 ms | 28340 KB | Extra information in the output file |
13 | Incorrect | 48 ms | 30412 KB | Extra information in the output file |
14 | Runtime error | 77 ms | 34644 KB | Memory limit exceeded |
15 | Runtime error | 66 ms | 35412 KB | Memory limit exceeded |
16 | Runtime error | 84 ms | 38228 KB | Memory limit exceeded |
17 | Runtime error | 121 ms | 40600 KB | Memory limit exceeded |
18 | Runtime error | 108 ms | 40276 KB | Memory limit exceeded |
19 | Runtime error | 123 ms | 41556 KB | Memory limit exceeded |
20 | Runtime error | 101 ms | 40544 KB | Memory limit exceeded |