#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
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
66 ms |
8300 KB |
Output is correct |
5 |
Correct |
65 ms |
8308 KB |
Output is correct |
6 |
Correct |
65 ms |
8236 KB |
Output is correct |
7 |
Correct |
66 ms |
8264 KB |
Output is correct |
8 |
Correct |
65 ms |
8244 KB |
Output is correct |
9 |
Correct |
68 ms |
8260 KB |
Output is correct |
10 |
Correct |
67 ms |
8268 KB |
Output is correct |
11 |
Correct |
89 ms |
8256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
304 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
4 ms |
724 KB |
Output is correct |
6 |
Correct |
73 ms |
8840 KB |
Output is correct |
7 |
Correct |
95 ms |
8784 KB |
Output is correct |
8 |
Correct |
78 ms |
8780 KB |
Output is correct |
9 |
Correct |
90 ms |
8860 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
4 ms |
596 KB |
Output is correct |
13 |
Correct |
4 ms |
724 KB |
Output is correct |
14 |
Correct |
80 ms |
8864 KB |
Output is correct |
15 |
Correct |
98 ms |
8752 KB |
Output is correct |
16 |
Correct |
75 ms |
8780 KB |
Output is correct |
17 |
Correct |
73 ms |
8888 KB |
Output is correct |
18 |
Correct |
75 ms |
8876 KB |
Output is correct |
19 |
Correct |
73 ms |
8760 KB |
Output is correct |
20 |
Correct |
75 ms |
8776 KB |
Output is correct |
21 |
Correct |
74 ms |
8772 KB |
Output is correct |
22 |
Correct |
75 ms |
8880 KB |
Output is correct |
23 |
Correct |
80 ms |
8864 KB |
Output is correct |
24 |
Correct |
75 ms |
8880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |