# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532903 | louiskwok | Job Scheduling (CEOI12_jobs) | C++17 | 502 ms | 26884 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;
struct Job {
int id;
int day;
bool operator<(const Job arb) const { return day < arb.day; }
} job[1000005];
int n,d,m;
vector <int> tmp[100005],ans[100005];
bool possible(int x) {
int ptr = 1;
for (int i=1;i<=n;i++) {
tmp[i].clear();
for (int j=0;j<x;j++) {
if (job[ptr].day>i) break;
if (job[ptr].day+d>=i) tmp[i].push_back(job[ptr++].id);
else return false;
if (ptr>m) return true;
}
}
return false;
}
int main() {
cin >> n >> d >> m;
for (int i=1;i<=m;i++) {
cin >> job[i].day;
job[i].id = i;
}
sort(job+1,job+m+1);
int lo = 1,hi = m;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |