Submission #434477

# Submission time Handle Problem Language Result Execution time Memory
434477 2021-06-21T10:59:00 Z egekabas Job Scheduling (IOI19_job) C++14
24 / 100
345 ms 26956 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;
long long scheduling_cost(std::vector<int> p, std::vector<int> u, std::vector<int> d) {
	ll n = p.size();
	vector<vector<ll>> g(n);
	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 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 23 ms 4096 KB Output is correct
6 Correct 44 ms 8080 KB Output is correct
7 Correct 85 ms 11960 KB Output is correct
8 Correct 90 ms 15952 KB Output is correct
9 Correct 107 ms 15924 KB Output is correct
10 Correct 92 ms 15920 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 93 ms 15948 KB Output is correct
13 Correct 93 ms 15932 KB Output is correct
14 Correct 94 ms 16024 KB Output is correct
15 Correct 102 ms 15944 KB Output is correct
16 Correct 90 ms 15948 KB Output is correct
17 Correct 90 ms 15928 KB Output is correct
18 Correct 88 ms 15920 KB Output is correct
19 Correct 91 ms 15852 KB Output is correct
20 Correct 90 ms 15928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 268 ms 26804 KB Output is correct
5 Correct 302 ms 26908 KB Output is correct
6 Correct 299 ms 26800 KB Output is correct
7 Correct 303 ms 26920 KB Output is correct
8 Correct 321 ms 26956 KB Output is correct
9 Correct 265 ms 26804 KB Output is correct
10 Correct 345 ms 26916 KB Output is correct
11 Correct 277 ms 26804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 10 ms 1612 KB Output is correct
6 Correct 310 ms 26896 KB Output is correct
7 Correct 268 ms 26804 KB Output is correct
8 Correct 253 ms 26812 KB Output is correct
9 Correct 266 ms 26816 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 460 KB Output is correct
12 Correct 7 ms 1356 KB Output is correct
13 Correct 7 ms 1612 KB Output is correct
14 Correct 260 ms 26868 KB Output is correct
15 Correct 318 ms 26900 KB Output is correct
16 Correct 252 ms 26800 KB Output is correct
17 Correct 279 ms 26896 KB Output is correct
18 Correct 276 ms 26884 KB Output is correct
19 Correct 255 ms 26816 KB Output is correct
20 Correct 267 ms 26912 KB Output is correct
21 Correct 327 ms 26832 KB Output is correct
22 Correct 278 ms 26800 KB Output is correct
23 Correct 303 ms 26812 KB Output is correct
24 Correct 261 ms 26792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 101 ms 15948 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 23 ms 4096 KB Output is correct
6 Correct 44 ms 8080 KB Output is correct
7 Correct 85 ms 11960 KB Output is correct
8 Correct 90 ms 15952 KB Output is correct
9 Correct 107 ms 15924 KB Output is correct
10 Correct 92 ms 15920 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 93 ms 15948 KB Output is correct
13 Correct 93 ms 15932 KB Output is correct
14 Correct 94 ms 16024 KB Output is correct
15 Correct 102 ms 15944 KB Output is correct
16 Correct 90 ms 15948 KB Output is correct
17 Correct 90 ms 15928 KB Output is correct
18 Correct 88 ms 15920 KB Output is correct
19 Correct 91 ms 15852 KB Output is correct
20 Correct 90 ms 15928 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 268 ms 26804 KB Output is correct
25 Correct 302 ms 26908 KB Output is correct
26 Correct 299 ms 26800 KB Output is correct
27 Correct 303 ms 26920 KB Output is correct
28 Correct 321 ms 26956 KB Output is correct
29 Correct 265 ms 26804 KB Output is correct
30 Correct 345 ms 26916 KB Output is correct
31 Correct 277 ms 26804 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 10 ms 1612 KB Output is correct
37 Correct 310 ms 26896 KB Output is correct
38 Correct 268 ms 26804 KB Output is correct
39 Correct 253 ms 26812 KB Output is correct
40 Correct 266 ms 26816 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 2 ms 460 KB Output is correct
43 Correct 7 ms 1356 KB Output is correct
44 Correct 7 ms 1612 KB Output is correct
45 Correct 260 ms 26868 KB Output is correct
46 Correct 318 ms 26900 KB Output is correct
47 Correct 252 ms 26800 KB Output is correct
48 Correct 279 ms 26896 KB Output is correct
49 Correct 276 ms 26884 KB Output is correct
50 Correct 255 ms 26816 KB Output is correct
51 Correct 267 ms 26912 KB Output is correct
52 Correct 327 ms 26832 KB Output is correct
53 Correct 278 ms 26800 KB Output is correct
54 Correct 303 ms 26812 KB Output is correct
55 Correct 261 ms 26792 KB Output is correct
56 Correct 1 ms 204 KB Output is correct
57 Incorrect 101 ms 15948 KB Output isn't correct
58 Halted 0 ms 0 KB -