이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |