답안 #432219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
432219 2021-06-18T04:03:25 Z Berted Job Scheduling (IOI19_job) C++14
24 / 100
195 ms 19768 KB
#include "job.h"
#include <vector>
#include <cassert>
#include <algorithm>
#include <queue>
#define vi vector<int>
#define ll long long
#define pii pair<ll, ll>
#define ppi pair<pii, ll>
#define fst first
#define snd second

using namespace std;

int N;
pii A[200001];
vi adj[200001];

inline bool comp(const ppi &l, const ppi &r)
{
	return make_pair(l.fst.fst * r.fst.snd, l.snd) < make_pair(r.fst.fst * l.fst.snd, r.snd);
}

priority_queue<ppi, vector<ppi>, decltype(&comp)> pq(comp);

long long scheduling_cost(vi p, vi u, vi d) 
{
	N = p.size();
	ll t = 0, res = 0;
	for (int i = 1; i < N; i++) adj[p[i]].push_back(i);
	
	pq.push({{u[0], d[0]}, 0});
	while (pq.size())
	{
		int uu = pq.top().snd; pii vv = pq.top().fst; pq.pop();
		t += vv.snd; res += t * vv.fst;
		for (const auto &w : adj[uu])
		{
			pq.push({{u[w], d[w]}, w});
		}
	}
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 4 ms 4984 KB Output is correct
4 Correct 5 ms 4940 KB Output is correct
5 Correct 26 ms 8456 KB Output is correct
6 Correct 47 ms 11892 KB Output is correct
7 Correct 68 ms 15428 KB Output is correct
8 Correct 91 ms 19068 KB Output is correct
9 Correct 94 ms 19128 KB Output is correct
10 Correct 96 ms 19076 KB Output is correct
11 Correct 4 ms 4980 KB Output is correct
12 Correct 94 ms 19076 KB Output is correct
13 Correct 92 ms 19076 KB Output is correct
14 Correct 92 ms 19012 KB Output is correct
15 Correct 106 ms 19068 KB Output is correct
16 Correct 95 ms 19204 KB Output is correct
17 Correct 92 ms 19072 KB Output is correct
18 Correct 93 ms 19072 KB Output is correct
19 Correct 95 ms 19072 KB Output is correct
20 Correct 93 ms 19012 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 4 ms 4980 KB Output is correct
3 Correct 3 ms 4924 KB Output is correct
4 Correct 184 ms 19164 KB Output is correct
5 Correct 167 ms 19044 KB Output is correct
6 Correct 176 ms 19076 KB Output is correct
7 Correct 176 ms 19052 KB Output is correct
8 Correct 166 ms 19072 KB Output is correct
9 Correct 166 ms 19048 KB Output is correct
10 Correct 179 ms 19052 KB Output is correct
11 Correct 190 ms 19056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 4 ms 4940 KB Output is correct
4 Correct 5 ms 4988 KB Output is correct
5 Correct 10 ms 5920 KB Output is correct
6 Correct 170 ms 19696 KB Output is correct
7 Correct 173 ms 19684 KB Output is correct
8 Correct 195 ms 19696 KB Output is correct
9 Correct 177 ms 19708 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 5 ms 5120 KB Output is correct
12 Correct 9 ms 5804 KB Output is correct
13 Correct 10 ms 5948 KB Output is correct
14 Correct 182 ms 19632 KB Output is correct
15 Correct 179 ms 19684 KB Output is correct
16 Correct 179 ms 19688 KB Output is correct
17 Correct 172 ms 19684 KB Output is correct
18 Correct 170 ms 19768 KB Output is correct
19 Correct 172 ms 19644 KB Output is correct
20 Correct 177 ms 19688 KB Output is correct
21 Correct 175 ms 19696 KB Output is correct
22 Correct 171 ms 19700 KB Output is correct
23 Correct 175 ms 19708 KB Output is correct
24 Correct 171 ms 19596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Incorrect 98 ms 19068 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Incorrect 4 ms 4984 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 4 ms 4984 KB Output is correct
4 Correct 5 ms 4940 KB Output is correct
5 Correct 26 ms 8456 KB Output is correct
6 Correct 47 ms 11892 KB Output is correct
7 Correct 68 ms 15428 KB Output is correct
8 Correct 91 ms 19068 KB Output is correct
9 Correct 94 ms 19128 KB Output is correct
10 Correct 96 ms 19076 KB Output is correct
11 Correct 4 ms 4980 KB Output is correct
12 Correct 94 ms 19076 KB Output is correct
13 Correct 92 ms 19076 KB Output is correct
14 Correct 92 ms 19012 KB Output is correct
15 Correct 106 ms 19068 KB Output is correct
16 Correct 95 ms 19204 KB Output is correct
17 Correct 92 ms 19072 KB Output is correct
18 Correct 93 ms 19072 KB Output is correct
19 Correct 95 ms 19072 KB Output is correct
20 Correct 93 ms 19012 KB Output is correct
21 Correct 4 ms 4940 KB Output is correct
22 Correct 4 ms 4980 KB Output is correct
23 Correct 3 ms 4924 KB Output is correct
24 Correct 184 ms 19164 KB Output is correct
25 Correct 167 ms 19044 KB Output is correct
26 Correct 176 ms 19076 KB Output is correct
27 Correct 176 ms 19052 KB Output is correct
28 Correct 166 ms 19072 KB Output is correct
29 Correct 166 ms 19048 KB Output is correct
30 Correct 179 ms 19052 KB Output is correct
31 Correct 190 ms 19056 KB Output is correct
32 Correct 3 ms 4940 KB Output is correct
33 Correct 3 ms 4940 KB Output is correct
34 Correct 4 ms 4940 KB Output is correct
35 Correct 5 ms 4988 KB Output is correct
36 Correct 10 ms 5920 KB Output is correct
37 Correct 170 ms 19696 KB Output is correct
38 Correct 173 ms 19684 KB Output is correct
39 Correct 195 ms 19696 KB Output is correct
40 Correct 177 ms 19708 KB Output is correct
41 Correct 3 ms 4940 KB Output is correct
42 Correct 5 ms 5120 KB Output is correct
43 Correct 9 ms 5804 KB Output is correct
44 Correct 10 ms 5948 KB Output is correct
45 Correct 182 ms 19632 KB Output is correct
46 Correct 179 ms 19684 KB Output is correct
47 Correct 179 ms 19688 KB Output is correct
48 Correct 172 ms 19684 KB Output is correct
49 Correct 170 ms 19768 KB Output is correct
50 Correct 172 ms 19644 KB Output is correct
51 Correct 177 ms 19688 KB Output is correct
52 Correct 175 ms 19696 KB Output is correct
53 Correct 171 ms 19700 KB Output is correct
54 Correct 175 ms 19708 KB Output is correct
55 Correct 171 ms 19596 KB Output is correct
56 Correct 4 ms 4940 KB Output is correct
57 Incorrect 98 ms 19068 KB Output isn't correct
58 Halted 0 ms 0 KB -