제출 #559197

#제출 시각아이디문제언어결과실행 시간메모리
559197CookieJob Scheduling (CEOI12_jobs)C++14
55 / 100
247 ms13928 KiB
#include <bits/stdc++.h> using namespace std; #define LIFESUCKS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define ll long long #define ld long double #define ar array #include<cstdio> #define vt vector #include<fstream> ifstream fin("measurement.in"); ofstream fout("measurement.out"); #include<fstream> #define pb push_back #define all(c) (c).begin(), (c).end() //#define length(x) (int)(x).size() #define fi first #define se second #define vt vector using namespace std; int n, d, m; const int mxm = 1e6; vt<pair<int, int>>p; bool check(int mid){ int cr = 0; for(int i = 0; i < m; i += mid){ cr++; if(d + p[i].first < cr)return(false); } return(true); } int main() { LIFESUCKS; cin >> n >> d >> m; for(int i = 0; i < m; i++){ int x; cin >> x; p.pb({x, i + 1}); } sort(p.begin(), p.end()); int l = 1; int ans = -1; int r = m; while(l <= r){ int mid = l + (r - l) / 2; if(check(mid)){ ans = mid; r = mid - 1; }else{ l = mid + 1; } } cout << ans << "\n"; int cr = 0; for(int i = 0; i < m; i += ans){ cr++; for(int j = i; j < min(m, i +ans); j++){ cout << p[j].second << " "; } cout << 0 << "\n"; } for(int i = cr; i < n; i++)cout << 0 << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...