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;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
long long scheduling_cost(vector<int> p, vector<int> u, vector<int> d) {
int n = (int) p.size();
vector<int> order(n - 1);
iota(order.begin(), order.end(), 1);
sort(order.begin(), order.end(), [&](int i, int j) {
return d[i] * u[j] < d[j] * u[i];
});
order.insert(order.begin(), 0);
long long res = 0;
long long t = 0;
for (int i : order) {
t += d[i];
res += t * u[i];
}
return res;
}
#ifdef tabr
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
debug(scheduling_cost({-1, 0, 0}, {5, 2, 5}, {3, 4, 1}));
return 0;
}
#endif
# | 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... |