# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145187 | ecnerwala | Job Scheduling (IOI19_job) | C++14 | 324 ms | 18036 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 "job.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll scheduling_cost(vector<int> P, vector<int> U_, vector<int> D_) {
vector<ll> U(U_.begin(), U_.end());
vector<ll> D(D_.begin(), D_.end());
int N = int(P.size());
ll ans = 0;
for (int i = 0; i < N; i++) {
ans += U[i] * D[i];
}
// build things earlier with high U[i] / D[i]
auto cmp = [](pair<pair<ll, ll>, int> i, pair<pair<ll, ll>, int> j) {
// returns true if j comes first
return j.first.second * i.first.first < i.first.second * j.first.first;
};
priority_queue<pair<pair<ll, ll>, int>, vector<pair<pair<ll, ll>, int>>, decltype(cmp)> pq(cmp);
vector<char> dead(N);
for (int i = 1; i < N; i++) {
if (U[i] == 0 && D[i] == 0) {
dead[i] = true;
} else {
pq.emplace(pair<ll, ll>(U[i], D[i]), i);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |