답안 #143849

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
143849 2019-08-15T10:34:21 Z SpeedOfMagic Job Scheduling (IOI19_job) C++17
24 / 100
191 ms 14416 KB
#include "job.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//24 3
long long scheduling_cost(vector<int> p, vector<int> u, vector<int> d) {
	int n = p.size();
	ll t = 0;
	for (int i : d)
		t += i;
	
	int out[n];
	memset(out, 0, sizeof out);
	for (int i = 0; i < n; i++)
		if (p[i] != -1)
			out[p[i]]++;
	
	ll ans = 0;
	priority_queue<pair<long double, int>> cur;
	for (int i = 0; i < n; i++)
		if (out[i] == 0)
			cur.push({-(long double) u[i] / (long double) d[i], i});
	
	while (!cur.empty()) {
		int ind = cur.top().second;
		//cout << ind << " " << t << endl;
		cur.pop();
		ans += u[ind] * t;
		t -= d[ind];
		out[p[ind]]--;
		if (out[p[ind]] == 0)
			cur.push({-(long double) u[p[ind]] / (long double) d[p[ind]], p[ind]});
	}
	
	return ans;
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 23 ms 1656 KB Output is correct
6 Correct 44 ms 3192 KB Output is correct
7 Correct 65 ms 4472 KB Output is correct
8 Correct 86 ms 5872 KB Output is correct
9 Correct 86 ms 5852 KB Output is correct
10 Correct 85 ms 5880 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 85 ms 5752 KB Output is correct
13 Correct 86 ms 5880 KB Output is correct
14 Correct 87 ms 5880 KB Output is correct
15 Correct 88 ms 5832 KB Output is correct
16 Correct 86 ms 5752 KB Output is correct
17 Correct 86 ms 5800 KB Output is correct
18 Correct 85 ms 5880 KB Output is correct
19 Correct 88 ms 5768 KB Output is correct
20 Correct 85 ms 5880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 8 ms 256 KB Output is correct
4 Correct 163 ms 14200 KB Output is correct
5 Correct 166 ms 14180 KB Output is correct
6 Correct 165 ms 14284 KB Output is correct
7 Correct 163 ms 14416 KB Output is correct
8 Correct 163 ms 14176 KB Output is correct
9 Correct 164 ms 14128 KB Output is correct
10 Correct 166 ms 14176 KB Output is correct
11 Correct 161 ms 14176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 9 ms 1268 KB Output is correct
6 Correct 180 ms 14092 KB Output is correct
7 Correct 165 ms 14180 KB Output is correct
8 Correct 169 ms 14176 KB Output is correct
9 Correct 191 ms 14176 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 504 KB Output is correct
12 Correct 8 ms 1140 KB Output is correct
13 Correct 9 ms 1268 KB Output is correct
14 Correct 166 ms 14132 KB Output is correct
15 Correct 166 ms 14176 KB Output is correct
16 Correct 175 ms 14128 KB Output is correct
17 Correct 180 ms 14236 KB Output is correct
18 Correct 173 ms 14224 KB Output is correct
19 Correct 188 ms 14176 KB Output is correct
20 Correct 167 ms 14176 KB Output is correct
21 Correct 172 ms 14132 KB Output is correct
22 Correct 165 ms 14176 KB Output is correct
23 Correct 165 ms 14176 KB Output is correct
24 Correct 168 ms 14176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 23 ms 1656 KB Output is correct
6 Correct 44 ms 3192 KB Output is correct
7 Correct 65 ms 4472 KB Output is correct
8 Correct 86 ms 5872 KB Output is correct
9 Correct 86 ms 5852 KB Output is correct
10 Correct 85 ms 5880 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 85 ms 5752 KB Output is correct
13 Correct 86 ms 5880 KB Output is correct
14 Correct 87 ms 5880 KB Output is correct
15 Correct 88 ms 5832 KB Output is correct
16 Correct 86 ms 5752 KB Output is correct
17 Correct 86 ms 5800 KB Output is correct
18 Correct 85 ms 5880 KB Output is correct
19 Correct 88 ms 5768 KB Output is correct
20 Correct 85 ms 5880 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 8 ms 256 KB Output is correct
24 Correct 163 ms 14200 KB Output is correct
25 Correct 166 ms 14180 KB Output is correct
26 Correct 165 ms 14284 KB Output is correct
27 Correct 163 ms 14416 KB Output is correct
28 Correct 163 ms 14176 KB Output is correct
29 Correct 164 ms 14128 KB Output is correct
30 Correct 166 ms 14176 KB Output is correct
31 Correct 161 ms 14176 KB Output is correct
32 Correct 2 ms 380 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 3 ms 376 KB Output is correct
36 Correct 9 ms 1268 KB Output is correct
37 Correct 180 ms 14092 KB Output is correct
38 Correct 165 ms 14180 KB Output is correct
39 Correct 169 ms 14176 KB Output is correct
40 Correct 191 ms 14176 KB Output is correct
41 Correct 2 ms 256 KB Output is correct
42 Correct 3 ms 504 KB Output is correct
43 Correct 8 ms 1140 KB Output is correct
44 Correct 9 ms 1268 KB Output is correct
45 Correct 166 ms 14132 KB Output is correct
46 Correct 166 ms 14176 KB Output is correct
47 Correct 175 ms 14128 KB Output is correct
48 Correct 180 ms 14236 KB Output is correct
49 Correct 173 ms 14224 KB Output is correct
50 Correct 188 ms 14176 KB Output is correct
51 Correct 167 ms 14176 KB Output is correct
52 Correct 172 ms 14132 KB Output is correct
53 Correct 165 ms 14176 KB Output is correct
54 Correct 165 ms 14176 KB Output is correct
55 Correct 168 ms 14176 KB Output is correct
56 Incorrect 2 ms 256 KB Output isn't correct
57 Halted 0 ms 0 KB -