# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416227 | 2021-06-02T08:10:59 Z | iulia13 | Job Scheduling (CEOI12_jobs) | C++14 | 490 ms | 26708 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] << " "; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 41 ms | 4932 KB | Expected EOLN |
2 | Incorrect | 41 ms | 4924 KB | Expected EOLN |
3 | Incorrect | 54 ms | 4976 KB | Expected EOLN |
4 | Incorrect | 44 ms | 4956 KB | Expected EOLN |
5 | Incorrect | 41 ms | 4932 KB | Expected EOLN |
6 | Incorrect | 41 ms | 5032 KB | Expected EOLN |
7 | Incorrect | 41 ms | 5020 KB | Expected EOLN |
8 | Incorrect | 41 ms | 4928 KB | Expected EOLN |
9 | Incorrect | 67 ms | 8112 KB | Expected EOLN |
10 | Incorrect | 67 ms | 8132 KB | Expected EOLN |
11 | Incorrect | 58 ms | 4824 KB | Expected EOLN |
12 | Incorrect | 103 ms | 7152 KB | Expected EOLN |
13 | Incorrect | 156 ms | 10184 KB | Expected EOLN |
14 | Incorrect | 225 ms | 12980 KB | Expected EOLN |
15 | Incorrect | 261 ms | 13844 KB | Expected EOLN |
16 | Incorrect | 339 ms | 16992 KB | Expected EOLN |
17 | Incorrect | 396 ms | 21280 KB | Expected EOLN |
18 | Incorrect | 417 ms | 21932 KB | Expected EOLN |
19 | Incorrect | 490 ms | 26708 KB | Expected EOLN |
20 | Incorrect | 399 ms | 21368 KB | Expected EOLN |