# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1046644 | 2024-08-06T19:36:51 Z | mtshasta | Job Scheduling (CEOI12_jobs) | C++17 | 156 ms | 19676 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; void solve() { int n, d, m; cin >> n >> d >> m; vector<int> jobs(m), o(m); vector<vector<int>> res(n); for (int i = 0; i < m; ++i) { cin >> jobs[i]; --jobs[i]; } iota(o.begin(), o.end(), 0); sort(o.begin(), o.end(), [&](int i, int j) { return jobs[i] < jobs[j]; }); auto ok = [&](int mach) -> bool { int id = 0; for (int i = 0; i < n; ++i) { int cnt = 0; while (id < m && jobs[o[id]] <= i + d && cnt < mach) { ++id; ++cnt; } } return id == m; }; int l = 1, r = 1e6, ans; while (l <= r) { int mid = l + (r - l) / 2; if (!ok(mid)) l = mid + 1; else { ans = mid; r = mid - 1; } } cout << ans << '\n'; int id = 0; for (int i = 0; i < n; ++i) { int cnt = 0; while (id < m && jobs[o[id]] <= i + d && cnt < ans) { cout << o[id] + 1 << ' '; ++id; ++cnt; } cout << 0 << '\n'; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 2140 KB | Output isn't correct |
2 | Incorrect | 10 ms | 2256 KB | Output isn't correct |
3 | Incorrect | 10 ms | 2392 KB | Output isn't correct |
4 | Incorrect | 10 ms | 2372 KB | Output isn't correct |
5 | Incorrect | 13 ms | 2300 KB | Output isn't correct |
6 | Incorrect | 10 ms | 2396 KB | Output isn't correct |
7 | Incorrect | 11 ms | 2392 KB | Output isn't correct |
8 | Incorrect | 11 ms | 2396 KB | Output isn't correct |
9 | Incorrect | 18 ms | 4624 KB | Output isn't correct |
10 | Incorrect | 18 ms | 4440 KB | Output isn't correct |
11 | Incorrect | 16 ms | 2140 KB | Output isn't correct |
12 | Correct | 36 ms | 4092 KB | Output is correct |
13 | Incorrect | 48 ms | 5716 KB | Output isn't correct |
14 | Correct | 75 ms | 8272 KB | Output is correct |
15 | Incorrect | 82 ms | 9640 KB | Output isn't correct |
16 | Incorrect | 113 ms | 12144 KB | Output isn't correct |
17 | Incorrect | 127 ms | 14164 KB | Output isn't correct |
18 | Incorrect | 126 ms | 15440 KB | Output isn't correct |
19 | Incorrect | 156 ms | 19676 KB | Output isn't correct |
20 | Incorrect | 137 ms | 14096 KB | Output isn't correct |