#include "job.h"
#include <vector>
#include <set>
#include <iostream>
using namespace std;
#define ll long long
struct job{
int u, d, id;
bool operator < (const job &rhs) const{
if(d * 1ll * rhs.u == u * 1ll * rhs.d){
return rhs.d < d;
}
return d * 1ll * rhs.u < u * 1ll * rhs.d;
}
};
long long scheduling_cost(vector<int> p, vector<int> u, vector<int> d){
int n = p.size();
set<job> s;
vector<int> ord;
for(int i = 1; i < n; i ++)
s.insert({u[i], d[i], i});
ll ans = 0ll, tim = 0ll;
tim += d[0]; ans += tim * u[0];
for(auto i : s){
tim += d[i.id];
ans += tim * 1ll * u[i.id];
}
return ans;
}
# |
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 |
Correct |
1 ms |
288 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
332 KB |
Output is correct |
5 |
Correct |
6 ms |
1228 KB |
Output is correct |
6 |
Incorrect |
222 ms |
19848 KB |
Output isn't correct |
7 |
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 |
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 |
- |