Submission #267119

#TimeUsernameProblemLanguageResultExecution timeMemory
267119SortingJob Scheduling (CEOI12_jobs)C++17
55 / 100
179 ms15224 KiB
#include <bits/stdc++.h> using namespace std; const int k_N = 1e5 + 3; const int k_M = 1e6 + 3; int n, d, m; vector<int> jobs[k_N]; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> n >> d >> m; for(int i = 1; i <= m; ++i){ int x; cin >> x; jobs[x].push_back(i); } int ans = 0, sum = 0; for(int i = 1; i <= n - d; ++i){ sum += jobs[i].size(); ans = max(ans, sum / (i + d) + (bool)(sum % (i + d))); } cout << ans << "\n"; queue<int> q; for(int i = 1; i <= n; ++i){ for(int x: jobs[i]) q.push(x); int t = ans; while(t-- && !q.empty()){ cout << q.front() << " "; q.pop(); } cout << "0\n"; } } /* 8 2 12 1 2 4 2 1 3 5 6 2 3 6 4 */
#Verdict Execution timeMemoryGrader output
Fetching results...