Submission #210888

# Submission time Handle Problem Language Result Execution time Memory
210888 2020-03-19T01:31:29 Z daniel920712 Job Scheduling (IOI19_job) C++14
24 / 100
162 ms 24424 KB
#include "job.h"
#include <vector>
#include <queue>
using namespace std;
vector < int > Next[200005];
struct A
{
    long long u,t,where;
}all[200005];
bool operator > (A a,A b)
{
    return a.u*b.t<b.u*a.t;
}
priority_queue < A , vector < A > , greater < A > > how;
long long scheduling_cost(std::vector<int> p, std::vector<int> u, std::vector<int> d)
{
    long long N=(long long) u.size(),ans=0,t=0,i;
    for(i=0;i<N;i++)
    {
        all[i].u=u[i];
        all[i].t=d[i];
        all[i].where=i;
    }
    for(i=1;i<N;i++) Next[p[i]].push_back(i);
    how.push(all[0]);
    while(!how.empty())
    {
        A a=how.top();
        how.pop();
        t+=a.t;
        ans+=t*a.u;
        for(auto i:Next[a.where]) how.push(all[i]);
    }
    return ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 4992 KB Output is correct
4 Correct 7 ms 5120 KB Output is correct
5 Correct 31 ms 9720 KB Output is correct
6 Correct 54 ms 14328 KB Output is correct
7 Correct 82 ms 19192 KB Output is correct
8 Correct 103 ms 23928 KB Output is correct
9 Correct 111 ms 23796 KB Output is correct
10 Correct 104 ms 23928 KB Output is correct
11 Correct 7 ms 4992 KB Output is correct
12 Correct 112 ms 23800 KB Output is correct
13 Correct 104 ms 23804 KB Output is correct
14 Correct 105 ms 23944 KB Output is correct
15 Correct 109 ms 23800 KB Output is correct
16 Correct 105 ms 23800 KB Output is correct
17 Correct 106 ms 23928 KB Output is correct
18 Correct 110 ms 23928 KB Output is correct
19 Correct 102 ms 23904 KB Output is correct
20 Correct 104 ms 23800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Correct 8 ms 4992 KB Output is correct
3 Correct 7 ms 4992 KB Output is correct
4 Correct 148 ms 23908 KB Output is correct
5 Correct 140 ms 23912 KB Output is correct
6 Correct 136 ms 23908 KB Output is correct
7 Correct 135 ms 23908 KB Output is correct
8 Correct 138 ms 23928 KB Output is correct
9 Correct 137 ms 23908 KB Output is correct
10 Correct 149 ms 23908 KB Output is correct
11 Correct 144 ms 23908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 4992 KB Output is correct
4 Correct 8 ms 5120 KB Output is correct
5 Correct 13 ms 6256 KB Output is correct
6 Correct 152 ms 24420 KB Output is correct
7 Correct 162 ms 24420 KB Output is correct
8 Correct 156 ms 24420 KB Output is correct
9 Correct 144 ms 24420 KB Output is correct
10 Correct 7 ms 4992 KB Output is correct
11 Correct 8 ms 5248 KB Output is correct
12 Correct 12 ms 6128 KB Output is correct
13 Correct 13 ms 6256 KB Output is correct
14 Correct 151 ms 24420 KB Output is correct
15 Correct 148 ms 24420 KB Output is correct
16 Correct 153 ms 24420 KB Output is correct
17 Correct 152 ms 24420 KB Output is correct
18 Correct 145 ms 24420 KB Output is correct
19 Correct 150 ms 24420 KB Output is correct
20 Correct 152 ms 24420 KB Output is correct
21 Correct 158 ms 24424 KB Output is correct
22 Correct 149 ms 24420 KB Output is correct
23 Correct 151 ms 24396 KB Output is correct
24 Correct 155 ms 24420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Incorrect 109 ms 23800 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Incorrect 7 ms 4992 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 4992 KB Output is correct
4 Correct 7 ms 5120 KB Output is correct
5 Correct 31 ms 9720 KB Output is correct
6 Correct 54 ms 14328 KB Output is correct
7 Correct 82 ms 19192 KB Output is correct
8 Correct 103 ms 23928 KB Output is correct
9 Correct 111 ms 23796 KB Output is correct
10 Correct 104 ms 23928 KB Output is correct
11 Correct 7 ms 4992 KB Output is correct
12 Correct 112 ms 23800 KB Output is correct
13 Correct 104 ms 23804 KB Output is correct
14 Correct 105 ms 23944 KB Output is correct
15 Correct 109 ms 23800 KB Output is correct
16 Correct 105 ms 23800 KB Output is correct
17 Correct 106 ms 23928 KB Output is correct
18 Correct 110 ms 23928 KB Output is correct
19 Correct 102 ms 23904 KB Output is correct
20 Correct 104 ms 23800 KB Output is correct
21 Correct 7 ms 4992 KB Output is correct
22 Correct 8 ms 4992 KB Output is correct
23 Correct 7 ms 4992 KB Output is correct
24 Correct 148 ms 23908 KB Output is correct
25 Correct 140 ms 23912 KB Output is correct
26 Correct 136 ms 23908 KB Output is correct
27 Correct 135 ms 23908 KB Output is correct
28 Correct 138 ms 23928 KB Output is correct
29 Correct 137 ms 23908 KB Output is correct
30 Correct 149 ms 23908 KB Output is correct
31 Correct 144 ms 23908 KB Output is correct
32 Correct 7 ms 4992 KB Output is correct
33 Correct 7 ms 4992 KB Output is correct
34 Correct 7 ms 4992 KB Output is correct
35 Correct 8 ms 5120 KB Output is correct
36 Correct 13 ms 6256 KB Output is correct
37 Correct 152 ms 24420 KB Output is correct
38 Correct 162 ms 24420 KB Output is correct
39 Correct 156 ms 24420 KB Output is correct
40 Correct 144 ms 24420 KB Output is correct
41 Correct 7 ms 4992 KB Output is correct
42 Correct 8 ms 5248 KB Output is correct
43 Correct 12 ms 6128 KB Output is correct
44 Correct 13 ms 6256 KB Output is correct
45 Correct 151 ms 24420 KB Output is correct
46 Correct 148 ms 24420 KB Output is correct
47 Correct 153 ms 24420 KB Output is correct
48 Correct 152 ms 24420 KB Output is correct
49 Correct 145 ms 24420 KB Output is correct
50 Correct 150 ms 24420 KB Output is correct
51 Correct 152 ms 24420 KB Output is correct
52 Correct 158 ms 24424 KB Output is correct
53 Correct 149 ms 24420 KB Output is correct
54 Correct 151 ms 24396 KB Output is correct
55 Correct 155 ms 24420 KB Output is correct
56 Correct 7 ms 4992 KB Output is correct
57 Incorrect 109 ms 23800 KB Output isn't correct
58 Halted 0 ms 0 KB -