#include "job.h"
#include <vector>
#include <cassert>
#include <algorithm>
#define vi vector<int>
#define ll long long
#define pii pair<ll, ll>
#define fst first
#define snd second
using namespace std;
int N;
pii A[200001];
inline bool comp(const pii &l, const pii &r)
{
return l.fst * r.snd > r.fst * l.snd;
}
long long scheduling_cost(vi p, vi u, vi d)
{
N = p.size();
ll t = d[0], res = d[0] * u[0];
for (int i = 1; i < N; i++)
{
assert(p[i] == 0);
A[i] = {u[i], d[i]};
}
sort(A + 1, A + N, comp);
for (int i = 1; i < N; i++)
{
t += A[i].snd;
res += A[i].fst * t;
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
92 ms |
9764 KB |
Output is correct |
5 |
Correct |
90 ms |
9760 KB |
Output is correct |
6 |
Correct |
90 ms |
9764 KB |
Output is correct |
7 |
Correct |
91 ms |
9796 KB |
Output is correct |
8 |
Correct |
90 ms |
9772 KB |
Output is correct |
9 |
Correct |
89 ms |
9860 KB |
Output is correct |
10 |
Correct |
90 ms |
9760 KB |
Output is correct |
11 |
Correct |
107 ms |
9760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
5 ms |
728 KB |
Output is correct |
6 |
Correct |
103 ms |
10472 KB |
Output is correct |
7 |
Correct |
98 ms |
10412 KB |
Output is correct |
8 |
Correct |
97 ms |
10308 KB |
Output is correct |
9 |
Correct |
100 ms |
10396 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
5 ms |
676 KB |
Output is correct |
13 |
Correct |
6 ms |
716 KB |
Output is correct |
14 |
Correct |
96 ms |
10404 KB |
Output is correct |
15 |
Correct |
104 ms |
10400 KB |
Output is correct |
16 |
Correct |
97 ms |
10404 KB |
Output is correct |
17 |
Correct |
97 ms |
10412 KB |
Output is correct |
18 |
Correct |
101 ms |
10420 KB |
Output is correct |
19 |
Correct |
96 ms |
10396 KB |
Output is correct |
20 |
Correct |
102 ms |
10308 KB |
Output is correct |
21 |
Correct |
98 ms |
10404 KB |
Output is correct |
22 |
Correct |
98 ms |
10288 KB |
Output is correct |
23 |
Correct |
95 ms |
10308 KB |
Output is correct |
24 |
Correct |
114 ms |
10456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |