제출 #1087558

#제출 시각아이디문제언어결과실행 시간메모리
1087558Rafael_AugustoJob Scheduling (CEOI12_jobs)C++17
0 / 100
168 ms21072 KiB
#include <bits/stdc++.h> using namespace std; #define f first #define s second #define dbg(v) cerr << #v << " = " << v << "\n" #define fall(i, n) for(int i=0; i<n; i++) typedef long long ll; typedef pair<int, int> pii; int n, d, m; vector<pii> v; bool f(int c){ fall(i, n) if(i/c - v[i].f > d) return 0; return 1; } int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> n >> d >> m; v=vector<pii>(m); fall(i, m){ cin >> v[i].f; v[i].s = i+1; } sort(v.begin(), v.end()); int ini=1, fim = m; while(ini < fim){ ll mid = (ini+fim)/2; if(f(mid)) fim = mid; else ini = mid+1; } cout << fim << "\n"; int id=0; fall(i, n){ fall(j, fim){ if(id >= m) break; if(v[id+j].f <= i+1) cout << v[id+j].s << " "; else{ id+=j; break;} if(j == fim-1) id += fim; } cout << "0\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...