제출 #693442

#제출 시각아이디문제언어결과실행 시간메모리
693442ojuzuser12Job Scheduling (CEOI12_jobs)C++17
15 / 100
271 ms17196 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, D, M; cin >> N >> D >> M; vector<pair<int, int>> jobs(M); for(int i = 0; i < M; i++) { cin >> jobs[i].first; jobs[i].second = i; } sort(jobs.begin(), jobs.end()); int l = 1, r = M, mid; while(l < r) { mid = (l + r) / 2; bool works = true; for(int d = 0; d < min((M + mid - 1) / mid, N); d++) { for(int i = d * mid; i < min(M, (d + 1) * mid); i++) { if(d - jobs[i].first > D) { works = false; break; } } if(!works) break; } if(works) { r = mid; } else { l = mid + 1; } } cout << r << '\n'; for(int d = 0; d < N; d++) { for(long long i = (long long) d * r; i < min((long long) M, (long long) (d + 1) * r); i++) { cout << jobs[i].second + 1 << ' '; } cout << 0 << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...