Submission #314853

# Submission time Handle Problem Language Result Execution time Memory
314853 2020-10-21T13:40:25 Z blue Job Scheduling (IOI19_job) C++17
24 / 100
314 ms 36572 KB
#include "job.h"
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

struct job
{
    long long u;
    long long d;
    int i;
    vector<int> children;
};

bool operator < (job A, job B)
{
    if(A.u*B.d == B.u*A.d) return A.i < B.i;
    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], 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 29 ms 6144 KB Output is correct
6 Correct 59 ms 11640 KB Output is correct
7 Correct 91 ms 17176 KB Output is correct
8 Correct 119 ms 22208 KB Output is correct
9 Correct 115 ms 22264 KB Output is correct
10 Correct 119 ms 22264 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 115 ms 22392 KB Output is correct
13 Correct 114 ms 22520 KB Output is correct
14 Correct 114 ms 22008 KB Output is correct
15 Correct 118 ms 22136 KB Output is correct
16 Correct 123 ms 22008 KB Output is correct
17 Correct 124 ms 22008 KB Output is correct
18 Correct 121 ms 22012 KB Output is correct
19 Correct 118 ms 22012 KB Output is correct
20 Correct 117 ms 22012 KB Output is correct
# 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 1 ms 384 KB Output is correct
4 Correct 314 ms 36448 KB Output is correct
5 Correct 299 ms 36572 KB Output is correct
6 Correct 304 ms 36444 KB Output is correct
7 Correct 300 ms 36452 KB Output is correct
8 Correct 295 ms 36460 KB Output is correct
9 Correct 305 ms 36572 KB Output is correct
10 Correct 297 ms 36444 KB Output is correct
11 Correct 303 ms 36448 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 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 9 ms 2176 KB Output is correct
6 Correct 290 ms 36220 KB Output is correct
7 Correct 288 ms 36060 KB Output is correct
8 Correct 284 ms 36188 KB Output is correct
9 Correct 286 ms 36060 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 2 ms 512 KB Output is correct
12 Correct 8 ms 1920 KB Output is correct
13 Correct 9 ms 2176 KB Output is correct
14 Correct 281 ms 36060 KB Output is correct
15 Correct 279 ms 36060 KB Output is correct
16 Correct 291 ms 36060 KB Output is correct
17 Correct 281 ms 36060 KB Output is correct
18 Correct 282 ms 36060 KB Output is correct
19 Correct 286 ms 36060 KB Output is correct
20 Correct 283 ms 36060 KB Output is correct
21 Correct 286 ms 36060 KB Output is correct
22 Correct 282 ms 36060 KB Output is correct
23 Correct 284 ms 36060 KB Output is correct
24 Correct 282 ms 36060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 135 ms 21624 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 29 ms 6144 KB Output is correct
6 Correct 59 ms 11640 KB Output is correct
7 Correct 91 ms 17176 KB Output is correct
8 Correct 119 ms 22208 KB Output is correct
9 Correct 115 ms 22264 KB Output is correct
10 Correct 119 ms 22264 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 115 ms 22392 KB Output is correct
13 Correct 114 ms 22520 KB Output is correct
14 Correct 114 ms 22008 KB Output is correct
15 Correct 118 ms 22136 KB Output is correct
16 Correct 123 ms 22008 KB Output is correct
17 Correct 124 ms 22008 KB Output is correct
18 Correct 121 ms 22012 KB Output is correct
19 Correct 118 ms 22012 KB Output is correct
20 Correct 117 ms 22012 KB Output is correct
21 Correct 0 ms 256 KB Output is correct
22 Correct 0 ms 256 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 314 ms 36448 KB Output is correct
25 Correct 299 ms 36572 KB Output is correct
26 Correct 304 ms 36444 KB Output is correct
27 Correct 300 ms 36452 KB Output is correct
28 Correct 295 ms 36460 KB Output is correct
29 Correct 305 ms 36572 KB Output is correct
30 Correct 297 ms 36444 KB Output is correct
31 Correct 303 ms 36448 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 0 ms 256 KB Output is correct
34 Correct 1 ms 256 KB Output is correct
35 Correct 1 ms 512 KB Output is correct
36 Correct 9 ms 2176 KB Output is correct
37 Correct 290 ms 36220 KB Output is correct
38 Correct 288 ms 36060 KB Output is correct
39 Correct 284 ms 36188 KB Output is correct
40 Correct 286 ms 36060 KB Output is correct
41 Correct 1 ms 256 KB Output is correct
42 Correct 2 ms 512 KB Output is correct
43 Correct 8 ms 1920 KB Output is correct
44 Correct 9 ms 2176 KB Output is correct
45 Correct 281 ms 36060 KB Output is correct
46 Correct 279 ms 36060 KB Output is correct
47 Correct 291 ms 36060 KB Output is correct
48 Correct 281 ms 36060 KB Output is correct
49 Correct 282 ms 36060 KB Output is correct
50 Correct 286 ms 36060 KB Output is correct
51 Correct 283 ms 36060 KB Output is correct
52 Correct 286 ms 36060 KB Output is correct
53 Correct 282 ms 36060 KB Output is correct
54 Correct 284 ms 36060 KB Output is correct
55 Correct 282 ms 36060 KB Output is correct
56 Correct 1 ms 256 KB Output is correct
57 Incorrect 135 ms 21624 KB Output isn't correct
58 Halted 0 ms 0 KB -