# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41289 | 2018-02-15T16:28:01 Z | evpipis | Job Scheduling (CEOI12_jobs) | C++ | 43 ms | 10404 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second typedef pair<int, int> ii; const int len = 1e5+5; int n, d, m; ii a[len]; bool check(int x){ int po = 0; for (int i = 1; i <= n+1; i++){ int temp = x; while (po < m && temp-- && a[po].fi <= i){ if (i > d+a[po].fi) return false; po++; } } return true; } int bs(){ int l = 1, r = m, ans; while (l <= r){ int mid = (l+r)/2; if (check(mid)){ ans = mid; r = mid-1; } else l = mid+1; } return ans; } int main(){ scanf("%d %d %d", &n, &d, &m); for (int i = 0; i < m; i++){ scanf("%d", &a[i].fi); a[i].se = i+1; } sort(a, a+m); int x = bs(); printf("%d\n", x); int po = 0; for (int i = 1; i <= n; i++){ int temp = x; while (po < m && temp-- && a[po].fi <= i){ printf("%d ", a[po].se); po++; } printf("0\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 1912 KB | Output is correct |
2 | Correct | 30 ms | 2324 KB | Output is correct |
3 | Correct | 32 ms | 2872 KB | Output is correct |
4 | Correct | 27 ms | 3192 KB | Output is correct |
5 | Correct | 29 ms | 3576 KB | Output is correct |
6 | Correct | 29 ms | 3872 KB | Output is correct |
7 | Correct | 29 ms | 4040 KB | Output is correct |
8 | Correct | 29 ms | 4336 KB | Output is correct |
9 | Correct | 40 ms | 4888 KB | Output is correct |
10 | Correct | 43 ms | 5012 KB | Output is correct |
11 | Correct | 39 ms | 5264 KB | Output is correct |
12 | Incorrect | 16 ms | 5264 KB | Output isn't correct |
13 | Incorrect | 17 ms | 6016 KB | Output isn't correct |
14 | Incorrect | 17 ms | 6640 KB | Output isn't correct |
15 | Incorrect | 21 ms | 7136 KB | Output isn't correct |
16 | Incorrect | 16 ms | 7888 KB | Output isn't correct |
17 | Incorrect | 18 ms | 8512 KB | Output isn't correct |
18 | Incorrect | 15 ms | 9136 KB | Output isn't correct |
19 | Incorrect | 18 ms | 9924 KB | Output isn't correct |
20 | Incorrect | 28 ms | 10404 KB | Output isn't correct |