# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522011 | alexz1205 | Job Scheduling (CEOI12_jobs) | C++14 | 244 ms | 10500 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 <iostream>
#include <vector>
using namespace std;
int main() {
int n, d, m;
cin >> n >> d >> m;
vector<int> jobs[n];
for (int x = 0; x < m; x ++){
int a;
cin >> a;
jobs[a-1].push_back(x);
}
int lo = 0, hi = m;
while (lo <= hi){
int mid = lo + (hi-lo+1)/2;
int c = 0;
bool pos = true;
for (int x = 0; x < n; x ++){
c += jobs[x].size();
c -= mid;
c = max(0, c);
if (c >= d*mid){
pos = false;
break;
}
}
if (pos){
hi = mid-1;
}else {
lo = mid+1;
}
}
cout << hi+1 << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |