제출 #1166067

#제출 시각아이디문제언어결과실행 시간메모리
1166067novemnotesJob Scheduling (CEOI12_jobs)C++20
0 / 100
556 ms84784 KiB
#include <bits/stdc++.h> using namespace std; #define pii pair<int,int> int n,m,k,mc; map<int,vector<int>> mp; vector<int> v; void psh(int n){ for(auto x : mp[n])v.push_back(x); } int main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n >> m >> k; for(int i=1;i<=k;i++){ int x;cin >> x; mp[x].push_back(i); } int sum = 0,mx; for(int i=1;i<=1+m;i++){ sum += mp[i].size(); psh(i); } mx = sum; for(int i=m+2;i<=k;i++){ sum+=mp[i].size(); sum-=mp[i-m-1].size(); psh(i); mx = max(mx,sum); } mc = mx/(m+1); cout << mc << "\n"; int tmp = 0; for(int i=1;i<=n;i++){ for(int j = tmp;j<tmp+mc && v[j] != 0;j++){ cout << v[j] << " "; }tmp+=mc; cout << "0 \n"; } return 0; } /* 8 2 12 1 2 4 2 1 3 5 6 2 3 6 4 */
#Verdict Execution timeMemoryGrader output
Fetching results...