#include "job.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
lint scheduling_cost(vector<int> p, vector<int> u, vector<int> d) {
int n = p.size();
lint ans = 0;
if (accumulate(begin(p), end(p), 0ll) == 0) {
sort(begin(u), end(u));
lint t = 0;
for (int i = 0; i < n; i++) {
ans += (t + d[i]) * u[i];
t += d[i];
}
} else {
lint t = 0;
for (int i = 0; i < n; i++) {
ans += (t + d[i]) * u[i];
t += d[i];
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
16 ms |
2124 KB |
Output is correct |
6 |
Correct |
44 ms |
4128 KB |
Output is correct |
7 |
Correct |
51 ms |
6132 KB |
Output is correct |
8 |
Correct |
76 ms |
8100 KB |
Output is correct |
9 |
Correct |
95 ms |
8092 KB |
Output is correct |
10 |
Correct |
81 ms |
8236 KB |
Output is correct |
11 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
276 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
16 ms |
2124 KB |
Output is correct |
6 |
Correct |
44 ms |
4128 KB |
Output is correct |
7 |
Correct |
51 ms |
6132 KB |
Output is correct |
8 |
Correct |
76 ms |
8100 KB |
Output is correct |
9 |
Correct |
95 ms |
8092 KB |
Output is correct |
10 |
Correct |
81 ms |
8236 KB |
Output is correct |
11 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |