제출 #580665

#제출 시각아이디문제언어결과실행 시간메모리
580665vqpahmadJob Scheduling (CEOI12_jobs)C++14
40 / 100
244 ms13772 KiB
#include <bits/stdc++.h> #define ll long long #define endl '\n' #define all(a) a.begin(),a.end() #define mod (ll)(10000007) using namespace std; const int mx = 1e6 + 15; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,d,m; cin >> n >> d >> m; vector<pair<int,int>> a(m); for (int i=0;i<m;i++){ int x; cin >> x; a[i] = {x,i+1}; } sort(all(a)); int s = 0,e=m; int ans = m; while (s<=e){ int mid = (s+e)/2; int i = 0; int day = 1; while (i<m){ int up = upper_bound(all(a),make_pair(day,INT_MAX))-a.begin(); i = min(i+mid,up); day++; if (day==n+1) break; } if (i==m){ ans = mid; e = mid - 1; } else s = mid + 1; } cout << ans << endl; int cur = 0; for (int i=1;i<=n;i++){ int up = upper_bound(all(a),make_pair(i,INT_MAX))-a.begin(); int t = cur+ans; if (cur!=m){ for (;cur<min(t,up);cur++){ cout << a[cur].second << ' '; } } cout << 0 << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...