Submission #151112

# Submission time Handle Problem Language Result Execution time Memory
151112 2019-09-01T18:39:15 Z neki Job Scheduling (IOI19_job) C++14
24 / 100
219 ms 32472 KB
#include "job.h"
#include <bits/stdc++.h>
using namespace std;
#define maxn 200100
#define loop(i, a, b ) for(int i=a;i<b;i++)
typedef long long ll;
 
struct temp{
    ll a, t, sa;vector<ll> chs;
    bool operator<(const temp &dr) const {
        return sa*dr.t<dr.sa*t;
    }
};
temp ts[maxn];
 
 
ll scheduling_cost(vector<int> p, vector<int> a, vector<int> t) {
    ll n=p.size();
    loop(i,0, n) ts[i].a=a[i], ts[i].t=t[i], ts[i].sa=ts[i].a;
    loop(i, 0, n) if(p[i]!=-1) ts[p[i]].sa+=ts[i].sa, ts[p[i]].chs.push_back(i);
    priority_queue<temp> pq;pq.push(ts[0]);
    ll ct=0, ans=0;
    while(pq.size()){
        auto v=pq.top();pq.pop();
        ct+=v.t;
        ans+=ct * v.a;
        for(auto&& i: v.chs) pq.push(ts[i]);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 11 ms 9720 KB Output is correct
4 Correct 11 ms 9720 KB Output is correct
5 Correct 38 ms 13176 KB Output is correct
6 Correct 68 ms 16760 KB Output is correct
7 Correct 94 ms 20348 KB Output is correct
8 Correct 123 ms 23924 KB Output is correct
9 Correct 123 ms 23800 KB Output is correct
10 Correct 123 ms 23864 KB Output is correct
11 Correct 10 ms 9720 KB Output is correct
12 Correct 122 ms 23880 KB Output is correct
13 Correct 122 ms 23800 KB Output is correct
14 Correct 121 ms 23876 KB Output is correct
15 Correct 123 ms 23964 KB Output is correct
16 Correct 128 ms 23808 KB Output is correct
17 Correct 122 ms 23888 KB Output is correct
18 Correct 123 ms 23920 KB Output is correct
19 Correct 121 ms 23804 KB Output is correct
20 Correct 123 ms 23912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 12 ms 9720 KB Output is correct
4 Correct 197 ms 31804 KB Output is correct
5 Correct 185 ms 31724 KB Output is correct
6 Correct 199 ms 31812 KB Output is correct
7 Correct 189 ms 31812 KB Output is correct
8 Correct 178 ms 31688 KB Output is correct
9 Correct 180 ms 31784 KB Output is correct
10 Correct 175 ms 31808 KB Output is correct
11 Correct 209 ms 31912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 11 ms 9848 KB Output is correct
5 Correct 20 ms 11300 KB Output is correct
6 Correct 219 ms 32324 KB Output is correct
7 Correct 195 ms 32320 KB Output is correct
8 Correct 198 ms 32396 KB Output is correct
9 Correct 193 ms 32320 KB Output is correct
10 Correct 10 ms 9720 KB Output is correct
11 Correct 11 ms 9976 KB Output is correct
12 Correct 16 ms 11172 KB Output is correct
13 Correct 17 ms 11172 KB Output is correct
14 Correct 209 ms 32296 KB Output is correct
15 Correct 202 ms 32472 KB Output is correct
16 Correct 200 ms 32320 KB Output is correct
17 Correct 200 ms 32316 KB Output is correct
18 Correct 195 ms 32304 KB Output is correct
19 Correct 214 ms 32324 KB Output is correct
20 Correct 187 ms 32444 KB Output is correct
21 Correct 195 ms 32280 KB Output is correct
22 Correct 199 ms 32376 KB Output is correct
23 Correct 190 ms 32316 KB Output is correct
24 Correct 196 ms 32320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 9720 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 9720 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 11 ms 9720 KB Output is correct
4 Correct 11 ms 9720 KB Output is correct
5 Correct 38 ms 13176 KB Output is correct
6 Correct 68 ms 16760 KB Output is correct
7 Correct 94 ms 20348 KB Output is correct
8 Correct 123 ms 23924 KB Output is correct
9 Correct 123 ms 23800 KB Output is correct
10 Correct 123 ms 23864 KB Output is correct
11 Correct 10 ms 9720 KB Output is correct
12 Correct 122 ms 23880 KB Output is correct
13 Correct 122 ms 23800 KB Output is correct
14 Correct 121 ms 23876 KB Output is correct
15 Correct 123 ms 23964 KB Output is correct
16 Correct 128 ms 23808 KB Output is correct
17 Correct 122 ms 23888 KB Output is correct
18 Correct 123 ms 23920 KB Output is correct
19 Correct 121 ms 23804 KB Output is correct
20 Correct 123 ms 23912 KB Output is correct
21 Correct 10 ms 9720 KB Output is correct
22 Correct 10 ms 9720 KB Output is correct
23 Correct 12 ms 9720 KB Output is correct
24 Correct 197 ms 31804 KB Output is correct
25 Correct 185 ms 31724 KB Output is correct
26 Correct 199 ms 31812 KB Output is correct
27 Correct 189 ms 31812 KB Output is correct
28 Correct 178 ms 31688 KB Output is correct
29 Correct 180 ms 31784 KB Output is correct
30 Correct 175 ms 31808 KB Output is correct
31 Correct 209 ms 31912 KB Output is correct
32 Correct 12 ms 9720 KB Output is correct
33 Correct 10 ms 9720 KB Output is correct
34 Correct 10 ms 9720 KB Output is correct
35 Correct 11 ms 9848 KB Output is correct
36 Correct 20 ms 11300 KB Output is correct
37 Correct 219 ms 32324 KB Output is correct
38 Correct 195 ms 32320 KB Output is correct
39 Correct 198 ms 32396 KB Output is correct
40 Correct 193 ms 32320 KB Output is correct
41 Correct 10 ms 9720 KB Output is correct
42 Correct 11 ms 9976 KB Output is correct
43 Correct 16 ms 11172 KB Output is correct
44 Correct 17 ms 11172 KB Output is correct
45 Correct 209 ms 32296 KB Output is correct
46 Correct 202 ms 32472 KB Output is correct
47 Correct 200 ms 32320 KB Output is correct
48 Correct 200 ms 32316 KB Output is correct
49 Correct 195 ms 32304 KB Output is correct
50 Correct 214 ms 32324 KB Output is correct
51 Correct 187 ms 32444 KB Output is correct
52 Correct 195 ms 32280 KB Output is correct
53 Correct 199 ms 32376 KB Output is correct
54 Correct 190 ms 32316 KB Output is correct
55 Correct 196 ms 32320 KB Output is correct
56 Incorrect 9 ms 9720 KB Output isn't correct
57 Halted 0 ms 0 KB -