제출 #559193

#제출 시각아이디문제언어결과실행 시간메모리
559193CookieJob Scheduling (CEOI12_jobs)C++14
0 / 100
155 ms8736 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; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...