# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
148034 |
2019-08-31T11:48:35 Z |
neki |
Job Scheduling (IOI19_job) |
C++14 |
|
232 ms |
37720 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, st;vector<ll> chs;
bool operator<(const temp &dr) const {
return sa*dr.st<dr.sa*st;
}
};
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, ts[i].st=ts[i].t;
loop(i, 0, n) if(p[i]!=-1) ts[p[i]].sa+=ts[i].sa, ts[p[i]].st+=ts[i].st, 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 |
11 ms |
11256 KB |
Output is correct |
2 |
Correct |
11 ms |
11256 KB |
Output is correct |
3 |
Correct |
11 ms |
11256 KB |
Output is correct |
4 |
Correct |
12 ms |
11384 KB |
Output is correct |
5 |
Correct |
40 ms |
14712 KB |
Output is correct |
6 |
Correct |
68 ms |
18296 KB |
Output is correct |
7 |
Correct |
97 ms |
21852 KB |
Output is correct |
8 |
Correct |
124 ms |
25464 KB |
Output is correct |
9 |
Correct |
125 ms |
25436 KB |
Output is correct |
10 |
Correct |
125 ms |
25416 KB |
Output is correct |
11 |
Correct |
11 ms |
11256 KB |
Output is correct |
12 |
Correct |
126 ms |
25504 KB |
Output is correct |
13 |
Correct |
125 ms |
25464 KB |
Output is correct |
14 |
Correct |
125 ms |
25464 KB |
Output is correct |
15 |
Correct |
124 ms |
25428 KB |
Output is correct |
16 |
Correct |
125 ms |
25464 KB |
Output is correct |
17 |
Correct |
125 ms |
25464 KB |
Output is correct |
18 |
Correct |
128 ms |
25692 KB |
Output is correct |
19 |
Correct |
124 ms |
25636 KB |
Output is correct |
20 |
Correct |
124 ms |
25440 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
11256 KB |
Output is correct |
2 |
Correct |
11 ms |
11256 KB |
Output is correct |
3 |
Correct |
11 ms |
11384 KB |
Output is correct |
4 |
Correct |
197 ms |
37040 KB |
Output is correct |
5 |
Correct |
208 ms |
37212 KB |
Output is correct |
6 |
Correct |
193 ms |
37004 KB |
Output is correct |
7 |
Correct |
200 ms |
37056 KB |
Output is correct |
8 |
Correct |
201 ms |
37116 KB |
Output is correct |
9 |
Correct |
232 ms |
37060 KB |
Output is correct |
10 |
Correct |
201 ms |
37056 KB |
Output is correct |
11 |
Correct |
201 ms |
37060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
11256 KB |
Output is correct |
2 |
Correct |
11 ms |
11256 KB |
Output is correct |
3 |
Correct |
11 ms |
11260 KB |
Output is correct |
4 |
Correct |
12 ms |
11512 KB |
Output is correct |
5 |
Correct |
19 ms |
12908 KB |
Output is correct |
6 |
Correct |
207 ms |
37540 KB |
Output is correct |
7 |
Correct |
209 ms |
37568 KB |
Output is correct |
8 |
Correct |
205 ms |
37696 KB |
Output is correct |
9 |
Correct |
204 ms |
37568 KB |
Output is correct |
10 |
Correct |
11 ms |
11256 KB |
Output is correct |
11 |
Correct |
12 ms |
11560 KB |
Output is correct |
12 |
Correct |
18 ms |
12780 KB |
Output is correct |
13 |
Correct |
19 ms |
12908 KB |
Output is correct |
14 |
Correct |
208 ms |
37572 KB |
Output is correct |
15 |
Correct |
207 ms |
37720 KB |
Output is correct |
16 |
Correct |
207 ms |
37588 KB |
Output is correct |
17 |
Correct |
204 ms |
37568 KB |
Output is correct |
18 |
Correct |
214 ms |
37648 KB |
Output is correct |
19 |
Correct |
205 ms |
37568 KB |
Output is correct |
20 |
Correct |
210 ms |
37556 KB |
Output is correct |
21 |
Correct |
202 ms |
37696 KB |
Output is correct |
22 |
Correct |
211 ms |
37656 KB |
Output is correct |
23 |
Correct |
210 ms |
37568 KB |
Output is correct |
24 |
Correct |
201 ms |
37552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
11256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
11256 KB |
Output is correct |
2 |
Incorrect |
11 ms |
11256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
11256 KB |
Output is correct |
2 |
Correct |
11 ms |
11256 KB |
Output is correct |
3 |
Correct |
11 ms |
11256 KB |
Output is correct |
4 |
Correct |
12 ms |
11384 KB |
Output is correct |
5 |
Correct |
40 ms |
14712 KB |
Output is correct |
6 |
Correct |
68 ms |
18296 KB |
Output is correct |
7 |
Correct |
97 ms |
21852 KB |
Output is correct |
8 |
Correct |
124 ms |
25464 KB |
Output is correct |
9 |
Correct |
125 ms |
25436 KB |
Output is correct |
10 |
Correct |
125 ms |
25416 KB |
Output is correct |
11 |
Correct |
11 ms |
11256 KB |
Output is correct |
12 |
Correct |
126 ms |
25504 KB |
Output is correct |
13 |
Correct |
125 ms |
25464 KB |
Output is correct |
14 |
Correct |
125 ms |
25464 KB |
Output is correct |
15 |
Correct |
124 ms |
25428 KB |
Output is correct |
16 |
Correct |
125 ms |
25464 KB |
Output is correct |
17 |
Correct |
125 ms |
25464 KB |
Output is correct |
18 |
Correct |
128 ms |
25692 KB |
Output is correct |
19 |
Correct |
124 ms |
25636 KB |
Output is correct |
20 |
Correct |
124 ms |
25440 KB |
Output is correct |
21 |
Correct |
11 ms |
11256 KB |
Output is correct |
22 |
Correct |
11 ms |
11256 KB |
Output is correct |
23 |
Correct |
11 ms |
11384 KB |
Output is correct |
24 |
Correct |
197 ms |
37040 KB |
Output is correct |
25 |
Correct |
208 ms |
37212 KB |
Output is correct |
26 |
Correct |
193 ms |
37004 KB |
Output is correct |
27 |
Correct |
200 ms |
37056 KB |
Output is correct |
28 |
Correct |
201 ms |
37116 KB |
Output is correct |
29 |
Correct |
232 ms |
37060 KB |
Output is correct |
30 |
Correct |
201 ms |
37056 KB |
Output is correct |
31 |
Correct |
201 ms |
37060 KB |
Output is correct |
32 |
Correct |
11 ms |
11256 KB |
Output is correct |
33 |
Correct |
11 ms |
11256 KB |
Output is correct |
34 |
Correct |
11 ms |
11260 KB |
Output is correct |
35 |
Correct |
12 ms |
11512 KB |
Output is correct |
36 |
Correct |
19 ms |
12908 KB |
Output is correct |
37 |
Correct |
207 ms |
37540 KB |
Output is correct |
38 |
Correct |
209 ms |
37568 KB |
Output is correct |
39 |
Correct |
205 ms |
37696 KB |
Output is correct |
40 |
Correct |
204 ms |
37568 KB |
Output is correct |
41 |
Correct |
11 ms |
11256 KB |
Output is correct |
42 |
Correct |
12 ms |
11560 KB |
Output is correct |
43 |
Correct |
18 ms |
12780 KB |
Output is correct |
44 |
Correct |
19 ms |
12908 KB |
Output is correct |
45 |
Correct |
208 ms |
37572 KB |
Output is correct |
46 |
Correct |
207 ms |
37720 KB |
Output is correct |
47 |
Correct |
207 ms |
37588 KB |
Output is correct |
48 |
Correct |
204 ms |
37568 KB |
Output is correct |
49 |
Correct |
214 ms |
37648 KB |
Output is correct |
50 |
Correct |
205 ms |
37568 KB |
Output is correct |
51 |
Correct |
210 ms |
37556 KB |
Output is correct |
52 |
Correct |
202 ms |
37696 KB |
Output is correct |
53 |
Correct |
211 ms |
37656 KB |
Output is correct |
54 |
Correct |
210 ms |
37568 KB |
Output is correct |
55 |
Correct |
201 ms |
37552 KB |
Output is correct |
56 |
Incorrect |
11 ms |
11256 KB |
Output isn't correct |
57 |
Halted |
0 ms |
0 KB |
- |