# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
314845 |
2020-10-21T13:26:07 Z |
blue |
Job Scheduling (IOI19_job) |
C++17 |
|
147 ms |
22264 KB |
#include "job.h"
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
struct job
{
long long u;
long long d;
vector<int> children;
};
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];
vector<int> v;
for(int i = 0; i < n; i++)
{
J[i] = job{u[i], d[i], v};
if(i > 0) J[p[i]].children.push_back(i);
}
long long t = 0;
set<job> S;
S.insert(J[0]);
job j;
while(!S.empty())
{
j = *S.begin();
S.erase(S.begin());
for(int k: j.children) S.insert(J[k]);
t += j.d;
res += t * j.u;
}
return res;
}
# |
Verdict |
Execution time |
Memory |
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 |
46 ms |
5752 KB |
Output is correct |
6 |
Correct |
67 ms |
10744 KB |
Output is correct |
7 |
Correct |
95 ms |
15352 KB |
Output is correct |
8 |
Correct |
126 ms |
20088 KB |
Output is correct |
9 |
Correct |
126 ms |
20088 KB |
Output is correct |
10 |
Correct |
132 ms |
20088 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
128 ms |
20088 KB |
Output is correct |
13 |
Correct |
135 ms |
20088 KB |
Output is correct |
14 |
Correct |
131 ms |
20236 KB |
Output is correct |
15 |
Correct |
129 ms |
20344 KB |
Output is correct |
16 |
Correct |
128 ms |
20216 KB |
Output is correct |
17 |
Correct |
128 ms |
20216 KB |
Output is correct |
18 |
Correct |
134 ms |
20228 KB |
Output is correct |
19 |
Correct |
132 ms |
20220 KB |
Output is correct |
20 |
Correct |
133 ms |
20216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
356 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Incorrect |
9 ms |
1920 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Incorrect |
147 ms |
22264 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
46 ms |
5752 KB |
Output is correct |
6 |
Correct |
67 ms |
10744 KB |
Output is correct |
7 |
Correct |
95 ms |
15352 KB |
Output is correct |
8 |
Correct |
126 ms |
20088 KB |
Output is correct |
9 |
Correct |
126 ms |
20088 KB |
Output is correct |
10 |
Correct |
132 ms |
20088 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
128 ms |
20088 KB |
Output is correct |
13 |
Correct |
135 ms |
20088 KB |
Output is correct |
14 |
Correct |
131 ms |
20236 KB |
Output is correct |
15 |
Correct |
129 ms |
20344 KB |
Output is correct |
16 |
Correct |
128 ms |
20216 KB |
Output is correct |
17 |
Correct |
128 ms |
20216 KB |
Output is correct |
18 |
Correct |
134 ms |
20228 KB |
Output is correct |
19 |
Correct |
132 ms |
20220 KB |
Output is correct |
20 |
Correct |
133 ms |
20216 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
0 ms |
256 KB |
Output is correct |
23 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
24 |
Halted |
0 ms |
0 KB |
- |