# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
882373 | vjudge1 | Job Scheduling (CEOI12_jobs) | C++14 | 43 ms | 3412 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |