#include "job.h"
#include <vector>
#include <algorithm>
using namespace std;
struct job
{
long long u;
long long d;
};
bool operator < (job A, job B)
{
return A.u*B.d > B.u*A.d;
}
long long scheduling_cost(vector<int> p, vector<int> u, vector<int> d)
{
long long res = 0;
int n = p.size();
job J[n-1];
for(int i = 1; i < n; i++) J[i-1] = job{u[i], d[i]};
sort(J, J+n-1);
long long t = d[0];
res += t * u[0];
for(int i = 0; i < n-1; i++)
{
t += J[i].d;
res += t * J[i].u;
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
85 ms |
9208 KB |
Output is correct |
5 |
Correct |
87 ms |
8988 KB |
Output is correct |
6 |
Correct |
85 ms |
9080 KB |
Output is correct |
7 |
Correct |
87 ms |
8992 KB |
Output is correct |
8 |
Correct |
85 ms |
9208 KB |
Output is correct |
9 |
Correct |
84 ms |
8976 KB |
Output is correct |
10 |
Correct |
85 ms |
9080 KB |
Output is correct |
11 |
Correct |
85 ms |
9080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
768 KB |
Output is correct |
6 |
Correct |
97 ms |
10488 KB |
Output is correct |
7 |
Correct |
94 ms |
10488 KB |
Output is correct |
8 |
Correct |
94 ms |
10488 KB |
Output is correct |
9 |
Correct |
95 ms |
10488 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
768 KB |
Output is correct |
13 |
Correct |
5 ms |
768 KB |
Output is correct |
14 |
Correct |
96 ms |
10488 KB |
Output is correct |
15 |
Correct |
96 ms |
10616 KB |
Output is correct |
16 |
Correct |
96 ms |
10488 KB |
Output is correct |
17 |
Correct |
93 ms |
10488 KB |
Output is correct |
18 |
Correct |
94 ms |
10488 KB |
Output is correct |
19 |
Correct |
94 ms |
10616 KB |
Output is correct |
20 |
Correct |
95 ms |
10488 KB |
Output is correct |
21 |
Correct |
94 ms |
10488 KB |
Output is correct |
22 |
Correct |
94 ms |
10492 KB |
Output is correct |
23 |
Correct |
93 ms |
10488 KB |
Output is correct |
24 |
Correct |
97 ms |
10488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
256 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 |
- |