#include "job.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
long long scheduling_cost(std::vector<int> p, std::vector<int> u, std::vector<int> d) {
int n = p.size();
vector<int> idx;
for (int i=1; i<n; i++) {
idx.emplace_back(i);
}
sort(idx.begin(), idx.end(), [&] (int i, int j) {
return 1LL*d[i]*u[j] < 1LL*d[j]*u[i];
});
ll ans = u[0]*d[0], sum = d[0];
for (auto v : idx) {
sum += d[v];
ans += sum * u[v];
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
256 KB |
Output is correct |
2 |
Correct |
6 ms |
256 KB |
Output is correct |
3 |
Correct |
7 ms |
376 KB |
Output is correct |
4 |
Correct |
155 ms |
6172 KB |
Output is correct |
5 |
Correct |
130 ms |
6228 KB |
Output is correct |
6 |
Correct |
124 ms |
6228 KB |
Output is correct |
7 |
Correct |
128 ms |
6268 KB |
Output is correct |
8 |
Correct |
127 ms |
6156 KB |
Output is correct |
9 |
Correct |
125 ms |
6152 KB |
Output is correct |
10 |
Correct |
128 ms |
6128 KB |
Output is correct |
11 |
Correct |
125 ms |
6256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
276 KB |
Output is correct |
2 |
Correct |
7 ms |
508 KB |
Output is correct |
3 |
Correct |
8 ms |
256 KB |
Output is correct |
4 |
Correct |
7 ms |
380 KB |
Output is correct |
5 |
Correct |
12 ms |
632 KB |
Output is correct |
6 |
Correct |
147 ms |
6204 KB |
Output is correct |
7 |
Correct |
138 ms |
6156 KB |
Output is correct |
8 |
Correct |
146 ms |
6288 KB |
Output is correct |
9 |
Correct |
141 ms |
6256 KB |
Output is correct |
10 |
Correct |
7 ms |
256 KB |
Output is correct |
11 |
Correct |
7 ms |
380 KB |
Output is correct |
12 |
Correct |
11 ms |
660 KB |
Output is correct |
13 |
Correct |
12 ms |
632 KB |
Output is correct |
14 |
Correct |
139 ms |
6272 KB |
Output is correct |
15 |
Correct |
151 ms |
6256 KB |
Output is correct |
16 |
Correct |
147 ms |
6176 KB |
Output is correct |
17 |
Correct |
141 ms |
6188 KB |
Output is correct |
18 |
Correct |
148 ms |
6480 KB |
Output is correct |
19 |
Correct |
150 ms |
6228 KB |
Output is correct |
20 |
Correct |
139 ms |
6260 KB |
Output is correct |
21 |
Correct |
146 ms |
6256 KB |
Output is correct |
22 |
Correct |
142 ms |
6256 KB |
Output is correct |
23 |
Correct |
166 ms |
6136 KB |
Output is correct |
24 |
Correct |
142 ms |
6224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |