# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1046672 | 2024-08-06T20:06:00 Z | mtshasta | Job Scheduling (CEOI12_jobs) | C++17 | 150 ms | 16248 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) { if (jobs[o[id]] > i) continue; int cnt = 0; while (id < m && jobs[o[id]] + d >= i && 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) { if (jobs[o[id]] > i) continue; int cnt = 0; while (id < m && jobs[o[id]] + d >= i && 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 | 1884 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 11 ms | 2000 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 14 ms | 1884 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 13 ms | 1892 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 11 ms | 2036 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 10 ms | 2012 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 11 ms | 1884 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 15 ms | 1932 KB | Unexpected end of file - int32 expected |
9 | Correct | 18 ms | 4372 KB | Output is correct |
10 | Correct | 18 ms | 4188 KB | Output is correct |
11 | Incorrect | 15 ms | 1628 KB | Unexpected end of file - int32 expected |
12 | Correct | 39 ms | 3304 KB | Output is correct |
13 | Correct | 52 ms | 4628 KB | Output is correct |
14 | Correct | 75 ms | 6388 KB | Output is correct |
15 | Incorrect | 81 ms | 7760 KB | Unexpected end of file - int32 expected |
16 | Incorrect | 99 ms | 9296 KB | Unexpected end of file - int32 expected |
17 | Incorrect | 150 ms | 10836 KB | Unexpected end of file - int32 expected |
18 | Correct | 129 ms | 12368 KB | Output is correct |
19 | Correct | 147 ms | 16248 KB | Output is correct |
20 | Incorrect | 126 ms | 10836 KB | Unexpected end of file - int32 expected |