# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416229 | 2021-06-02T08:12:15 Z | iulia13 | Job Scheduling (CEOI12_jobs) | C++14 | 497 ms | 23324 KB |
#include <iostream> #include <algorithm> #include <vector> using namespace std; const int M = 1e6 + 6; const int N = 1e5 + 5; pair <int, int> v[M]; vector <int> ans[N]; int main() { int n, d, m, i; cin >> n >> d >> m; for (i = 1; i <= m; i++) { cin >> v[i].first; v[i].second = i; } sort(v + 1, v + m + 1); int st = 1, dr = m, sol; while (st <= dr) { int mid = (st + dr) / 2; int bad = 0, day = 1; i = 1; while (i <= m && !bad) { int c = 0; while (!bad && c < mid && day >= v[i].first && i <= m) { if (v[i].first + d < day) bad = 1; c++; i++; } day++; } if (i <= m || bad) st = mid + 1; else { sol = mid; dr = mid - 1; } } cout << sol; int day = 1; i = 1; while (i <= m) { int c = 0; while (c < sol && day >= v[i].first && i <= m) { ans[day].push_back(v[i].second); c++; i++; } ans[day].push_back(0); day++; } while (day <= n) { ans[day].push_back(0); day++; } for (i = 1; i <= n; i++) { cout << '\n'; for (int j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " "; } cout << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 40 ms | 4732 KB | Expected EOLN |
2 | Incorrect | 41 ms | 4684 KB | Expected EOLN |
3 | Incorrect | 42 ms | 4680 KB | Expected EOLN |
4 | Incorrect | 42 ms | 4744 KB | Expected EOLN |
5 | Incorrect | 41 ms | 4676 KB | Expected EOLN |
6 | Incorrect | 41 ms | 4712 KB | Expected EOLN |
7 | Incorrect | 41 ms | 4656 KB | Expected EOLN |
8 | Incorrect | 41 ms | 4740 KB | Expected EOLN |
9 | Incorrect | 70 ms | 7876 KB | Expected EOLN |
10 | Incorrect | 66 ms | 7888 KB | Expected EOLN |
11 | Incorrect | 52 ms | 4492 KB | Expected EOLN |
12 | Incorrect | 105 ms | 6496 KB | Expected EOLN |
13 | Incorrect | 154 ms | 8896 KB | Expected EOLN |
14 | Incorrect | 232 ms | 11124 KB | Expected EOLN |
15 | Incorrect | 287 ms | 11868 KB | Expected EOLN |
16 | Incorrect | 333 ms | 14104 KB | Expected EOLN |
17 | Incorrect | 396 ms | 17904 KB | Expected EOLN |
18 | Incorrect | 427 ms | 18736 KB | Expected EOLN |
19 | Incorrect | 497 ms | 23324 KB | Expected EOLN |
20 | Incorrect | 390 ms | 17968 KB | Expected EOLN |