#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
256 KB |
Output is correct |
2 |
Correct |
6 ms |
356 KB |
Output is correct |
3 |
Correct |
6 ms |
256 KB |
Output is correct |
4 |
Correct |
123 ms |
7924 KB |
Output is correct |
5 |
Correct |
147 ms |
8048 KB |
Output is correct |
6 |
Correct |
129 ms |
8048 KB |
Output is correct |
7 |
Correct |
128 ms |
8048 KB |
Output is correct |
8 |
Correct |
135 ms |
8048 KB |
Output is correct |
9 |
Correct |
134 ms |
7960 KB |
Output is correct |
10 |
Correct |
129 ms |
8048 KB |
Output is correct |
11 |
Correct |
131 ms |
8092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Output is correct |
2 |
Correct |
6 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
256 KB |
Output is correct |
4 |
Correct |
7 ms |
376 KB |
Output is correct |
5 |
Correct |
13 ms |
760 KB |
Output is correct |
6 |
Correct |
145 ms |
8560 KB |
Output is correct |
7 |
Correct |
145 ms |
8688 KB |
Output is correct |
8 |
Correct |
150 ms |
8640 KB |
Output is correct |
9 |
Correct |
143 ms |
8532 KB |
Output is correct |
10 |
Correct |
6 ms |
256 KB |
Output is correct |
11 |
Correct |
7 ms |
376 KB |
Output is correct |
12 |
Correct |
12 ms |
760 KB |
Output is correct |
13 |
Correct |
12 ms |
760 KB |
Output is correct |
14 |
Correct |
144 ms |
8568 KB |
Output is correct |
15 |
Correct |
149 ms |
8724 KB |
Output is correct |
16 |
Correct |
142 ms |
8560 KB |
Output is correct |
17 |
Correct |
146 ms |
8508 KB |
Output is correct |
18 |
Correct |
150 ms |
8512 KB |
Output is correct |
19 |
Correct |
143 ms |
8560 KB |
Output is correct |
20 |
Correct |
144 ms |
8720 KB |
Output is correct |
21 |
Correct |
155 ms |
8720 KB |
Output is correct |
22 |
Correct |
146 ms |
8576 KB |
Output is correct |
23 |
Correct |
141 ms |
8560 KB |
Output is correct |
24 |
Correct |
145 ms |
8432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
252 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |