# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
938067 | TAhmed33 | Job Scheduling (CEOI12_jobs) | C++98 | 15 ms | 1612 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;
const int MAXN = 1e5 + 25;
int n, d, m;
int a[MAXN];
bool check (int x) {
bool flag = 1;
int c = 0;
for (int i = 1; i <= n; i++) {
if (i % x == 1) c++;
flag &= c <= a[i] + d;
}
return flag;
}
int main () {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> d >> m;
for (int i = 1; i <= m; i++) cin >> a[i];
sort(a + 1, a + m + 1);
int l = 2, r = m, ans = 1;
while (l <= r) {
int mid = (l + r) >> 1;
if (check(mid)) {
r = mid - 1; ans = mid;
} else {
l = mid + 1;
}
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |