# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
981537 | 2024-05-13T10:08:18 Z | SmuggingSpun | Job Scheduling (CEOI12_jobs) | C++14 | 112 ms | 13652 KB |
#include<bits/stdc++.h> #define taskname "jobs" using namespace std; const int lim = 1e5 + 5; vector<int>p[lim]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } int n, d, m; cin >> n >> d >> m; for(int i = 0; i < m; ){ int x; cin >> x; p[x].emplace_back(++i); } int low = 1, high = n, ans; while(low <= high){ int mid = (low + high) >> 1; deque<pair<int, int>>D; for(int i = 1; i <= n; i++){ int current = mid; if(!p[i].empty() > 0){ D.emplace_back(i, p[i].size()); } if(!D.empty() && D.front().first + d < i){ break; } while(!D.empty()){ auto [x, y] = D.front(); D.pop_front(); if(current >= y){ current -= y; } else{ D.emplace_front(x, y - current); break; } } } if(!D.empty()){ low = mid + 1; } else{ high = (ans = mid) - 1; } } cout << ans << "\n"; queue<int>q; for(int i = 1; i <= n; i++){ for(int& x : p[i]){ q.push(x); } for(int _ = 0; _ < ans && !q.empty(); _++, q.pop()){ cout << q.front() << " "; } cout << "0\n"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 4060 KB | Output isn't correct |
2 | Incorrect | 11 ms | 4060 KB | Output isn't correct |
3 | Incorrect | 12 ms | 4060 KB | Output isn't correct |
4 | Incorrect | 11 ms | 4060 KB | Output isn't correct |
5 | Incorrect | 12 ms | 4060 KB | Output isn't correct |
6 | Incorrect | 11 ms | 4060 KB | Output isn't correct |
7 | Incorrect | 11 ms | 4060 KB | Output isn't correct |
8 | Incorrect | 11 ms | 4060 KB | Output isn't correct |
9 | Correct | 14 ms | 4188 KB | Output is correct |
10 | Correct | 17 ms | 4184 KB | Output is correct |
11 | Correct | 12 ms | 3928 KB | Output is correct |
12 | Correct | 24 ms | 4956 KB | Output is correct |
13 | Correct | 35 ms | 6996 KB | Output is correct |
14 | Correct | 53 ms | 8188 KB | Output is correct |
15 | Correct | 64 ms | 9096 KB | Output is correct |
16 | Correct | 82 ms | 10724 KB | Output is correct |
17 | Correct | 112 ms | 12760 KB | Output is correct |
18 | Correct | 85 ms | 12676 KB | Output is correct |
19 | Correct | 101 ms | 13652 KB | Output is correct |
20 | Correct | 96 ms | 12576 KB | Output is correct |