Submission #434475

# Submission time Handle Problem Language Result Execution time Memory
434475 2021-06-21T10:53:36 Z egekabas Job Scheduling (IOI19_job) C++14
24 / 100
328 ms 29324 KB
#include "job.h"
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef pair<ll, ll> pll;
ll n;
vector<ll> g[200009];

long long scheduling_cost(std::vector<int> p, std::vector<int> u, std::vector<int> d) {
	n = p.size();
	set<pair<ld, ll>> s;
	for(ll i = 0; i < n; ++i){
		if(p[i] == -1)
			s.insert({0, i});
		else
			g[p[i]].pb(i);
	}
	ll ans = 0;
	ll curt = 0;
	while(s.size()){
		ll v = s.begin()->ss;
		s.erase(s.begin());
		curt += d[v];
		ans += curt*u[v];
		for(auto nxt : g[v])
			s.insert({ld(d[nxt])/ld(u[nxt]) , nxt});
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 5 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 5 ms 4940 KB Output is correct
5 Correct 25 ms 7728 KB Output is correct
6 Correct 60 ms 10364 KB Output is correct
7 Correct 68 ms 13132 KB Output is correct
8 Correct 95 ms 15896 KB Output is correct
9 Correct 99 ms 15956 KB Output is correct
10 Correct 90 ms 15940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 109 ms 15888 KB Output is correct
13 Correct 90 ms 15900 KB Output is correct
14 Correct 88 ms 15888 KB Output is correct
15 Correct 89 ms 15892 KB Output is correct
16 Correct 91 ms 15888 KB Output is correct
17 Correct 92 ms 16024 KB Output is correct
18 Correct 88 ms 15892 KB Output is correct
19 Correct 94 ms 16004 KB Output is correct
20 Correct 89 ms 15908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 262 ms 26840 KB Output is correct
5 Correct 328 ms 26896 KB Output is correct
6 Correct 259 ms 26888 KB Output is correct
7 Correct 323 ms 26900 KB Output is correct
8 Correct 273 ms 26884 KB Output is correct
9 Correct 322 ms 26932 KB Output is correct
10 Correct 275 ms 26876 KB Output is correct
11 Correct 247 ms 26916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 5 ms 5068 KB Output is correct
5 Correct 11 ms 5964 KB Output is correct
6 Correct 284 ms 27132 KB Output is correct
7 Correct 269 ms 29320 KB Output is correct
8 Correct 262 ms 29180 KB Output is correct
9 Correct 248 ms 29228 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 5 ms 5124 KB Output is correct
12 Correct 9 ms 5964 KB Output is correct
13 Correct 10 ms 6092 KB Output is correct
14 Correct 265 ms 29196 KB Output is correct
15 Correct 266 ms 29192 KB Output is correct
16 Correct 310 ms 29232 KB Output is correct
17 Correct 248 ms 29196 KB Output is correct
18 Correct 239 ms 29108 KB Output is correct
19 Correct 243 ms 29180 KB Output is correct
20 Correct 236 ms 29236 KB Output is correct
21 Correct 296 ms 29180 KB Output is correct
22 Correct 242 ms 29324 KB Output is correct
23 Correct 238 ms 29224 KB Output is correct
24 Correct 246 ms 29220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Incorrect 90 ms 19076 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Incorrect 3 ms 4940 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 5 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 5 ms 4940 KB Output is correct
5 Correct 25 ms 7728 KB Output is correct
6 Correct 60 ms 10364 KB Output is correct
7 Correct 68 ms 13132 KB Output is correct
8 Correct 95 ms 15896 KB Output is correct
9 Correct 99 ms 15956 KB Output is correct
10 Correct 90 ms 15940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 109 ms 15888 KB Output is correct
13 Correct 90 ms 15900 KB Output is correct
14 Correct 88 ms 15888 KB Output is correct
15 Correct 89 ms 15892 KB Output is correct
16 Correct 91 ms 15888 KB Output is correct
17 Correct 92 ms 16024 KB Output is correct
18 Correct 88 ms 15892 KB Output is correct
19 Correct 94 ms 16004 KB Output is correct
20 Correct 89 ms 15908 KB Output is correct
21 Correct 3 ms 4940 KB Output is correct
22 Correct 3 ms 4940 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 262 ms 26840 KB Output is correct
25 Correct 328 ms 26896 KB Output is correct
26 Correct 259 ms 26888 KB Output is correct
27 Correct 323 ms 26900 KB Output is correct
28 Correct 273 ms 26884 KB Output is correct
29 Correct 322 ms 26932 KB Output is correct
30 Correct 275 ms 26876 KB Output is correct
31 Correct 247 ms 26916 KB Output is correct
32 Correct 3 ms 4940 KB Output is correct
33 Correct 3 ms 4992 KB Output is correct
34 Correct 3 ms 4940 KB Output is correct
35 Correct 5 ms 5068 KB Output is correct
36 Correct 11 ms 5964 KB Output is correct
37 Correct 284 ms 27132 KB Output is correct
38 Correct 269 ms 29320 KB Output is correct
39 Correct 262 ms 29180 KB Output is correct
40 Correct 248 ms 29228 KB Output is correct
41 Correct 3 ms 4940 KB Output is correct
42 Correct 5 ms 5124 KB Output is correct
43 Correct 9 ms 5964 KB Output is correct
44 Correct 10 ms 6092 KB Output is correct
45 Correct 265 ms 29196 KB Output is correct
46 Correct 266 ms 29192 KB Output is correct
47 Correct 310 ms 29232 KB Output is correct
48 Correct 248 ms 29196 KB Output is correct
49 Correct 239 ms 29108 KB Output is correct
50 Correct 243 ms 29180 KB Output is correct
51 Correct 236 ms 29236 KB Output is correct
52 Correct 296 ms 29180 KB Output is correct
53 Correct 242 ms 29324 KB Output is correct
54 Correct 238 ms 29224 KB Output is correct
55 Correct 246 ms 29220 KB Output is correct
56 Correct 3 ms 4940 KB Output is correct
57 Incorrect 90 ms 19076 KB Output isn't correct
58 Halted 0 ms 0 KB -