# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
367370 | 2021-02-17T01:50:33 Z | PurpleCrayon | Job Scheduling (IOI19_job) | C++17 | 1 ms | 544 KB |
#include "job.h" #include <bits/stdc++.h> using namespace std; #define sz(v) int(v.size()) #define ar array typedef long long ll; ll scheduling_cost(vector<int> p, vector<int> u, vector<int> d) { int n=sz(p); vector<vector<int>> ch(n); for (int i = 1; i < n; i++) ch[p[i]].push_back(i); auto cmp = [&](int i, int j) -> bool { return ll(d[j])*ll(u[i]) < ll(d[i])*ll(u[j]); }; priority_queue<int, vector<int>, decltype(cmp)> roots(cmp); ll ans=0, t=0; roots.push(0); while (sz(roots)){ int c=roots.top(); roots.pop(); t += d[c], ans += t*u[c]; for (auto nxt : ch[c]) roots.push(nxt); } cout << ans << '\n'; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 492 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 492 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 544 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 492 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 492 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 492 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |