# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
882373 | vjudge1 | Job Scheduling (CEOI12_jobs) | C++14 | 43 ms | 3412 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define _for(i, a, b) for(LL i = (a); i < (b); ++i)
const int NN = 1e5 + 4;
using LL = long long;
int N, D, M, T[NN];
bool check(LL x){
int q = 0;
_for(i, 1, N - D + 1){
if((q += T[i]) > x * (D + 1)) return 0;
q = max(q - x, 0LL);
}
return 1;
}
int main(){
ios::sync_with_stdio(false), cin.tie(0);
cin >> N >> D >> M;
int r = M;
_for(i, 0, M) cin >> r, T[r]++;
for(int l = 1, m; l + 1 < r;) m = (l + r) / 2, (check(m) ? r : l) = m;
return printf("%d\n", r), 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |