# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
740769 | 2023-05-13T05:21:20 Z | bleu | Job Scheduling (CEOI12_jobs) | C++14 | 142 ms | 16832 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, d, m; cin >> n >> d >> m; vector<vector<int>> J(n); for(int i=0; i<m; i++) { int c; cin >> c; J[c-1].push_back(i+1); } int lo=0, hi=m; while(lo < hi) { int mid = (lo + hi) / 2; int t = 0; int rem; bool works=true; for(int i=0; i<n && works; i++) { int count = J[i].size(); count -= rem; t++; rem=mid; if(count<0) continue; while(count>0) { count-=mid; if(count<0) rem=-count; else t++; } if(t-i>d) works=false; } if(works) hi = mid; else lo = mid+1; } cout << lo << "\n"; int count=0; int acc=0; for(int i=0; i<n; i++) { for(int j : J[i]) { if(count>=lo) { cout << 0 << "\n" << j << " "; acc++; count=1; } else { cout << j << " "; count++; } } if(acc<=i) { cout << 0 << "\n"; count=0; acc++; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 1924 KB | Output isn't correct |
2 | Incorrect | 15 ms | 2008 KB | Output isn't correct |
3 | Incorrect | 15 ms | 2000 KB | Output isn't correct |
4 | Incorrect | 16 ms | 1920 KB | Output isn't correct |
5 | Incorrect | 16 ms | 1888 KB | Output isn't correct |
6 | Incorrect | 20 ms | 1944 KB | Output isn't correct |
7 | Incorrect | 15 ms | 1868 KB | Output isn't correct |
8 | Incorrect | 15 ms | 1904 KB | Output isn't correct |
9 | Incorrect | 23 ms | 4284 KB | Output isn't correct |
10 | Correct | 24 ms | 4352 KB | Output is correct |
11 | Correct | 15 ms | 1876 KB | Output is correct |
12 | Incorrect | 31 ms | 3428 KB | Output isn't correct |
13 | Correct | 44 ms | 5680 KB | Output is correct |
14 | Incorrect | 70 ms | 7804 KB | Output isn't correct |
15 | Correct | 71 ms | 8652 KB | Output is correct |
16 | Incorrect | 109 ms | 11416 KB | Output isn't correct |
17 | Correct | 120 ms | 13792 KB | Output is correct |
18 | Correct | 137 ms | 13488 KB | Output is correct |
19 | Correct | 142 ms | 16832 KB | Output is correct |
20 | Correct | 141 ms | 13776 KB | Output is correct |