답안 #917406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
917406 2024-01-28T05:40:27 Z pavement Truck Driver (IOI23_deliveries) C++17
29 / 100
5500 ms 23320 KB
#include "deliveries.h"
#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back

using ll = long long;
using ii = pair<int, int>;

ll ans, tot_W;
vector<int> W;
vector<ii> adj[100005];

ll dfs(int u, int e = -1) {
	ll ret = W[u];
	for (auto [v, w] : adj[u]) if (v != e) {
		auto tmp = dfs(v, u);
		ret += tmp;
		ans += min(tmp, tot_W - tmp + 1) * w;
	}
	return ret;
}

void init(int N, vector<int> U, vector<int> V, vector<int> T, vector<int> W) {
	for (int i = 0; i < N - 1; i++) {
		adj[U[i]].eb(V[i], T[i]);
		adj[V[i]].eb(U[i], T[i]);
	}
	::W = W;
	for (auto i : W) {
		tot_W += i;
	}
}

ll max_time(int S, int X) {
	tot_W += X - W[S];
	W[S] = X;
	ans = 0;
	dfs(0);
	return ans * 2;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 11860 KB Output is correct
2 Correct 73 ms 11600 KB Output is correct
3 Correct 72 ms 11936 KB Output is correct
4 Correct 71 ms 11860 KB Output is correct
5 Correct 107 ms 12220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2648 KB Output is correct
2 Correct 5 ms 2652 KB Output is correct
3 Correct 7 ms 2652 KB Output is correct
4 Correct 8 ms 2908 KB Output is correct
5 Correct 9 ms 2908 KB Output is correct
6 Correct 9 ms 2908 KB Output is correct
7 Correct 9 ms 2908 KB Output is correct
8 Correct 8 ms 2908 KB Output is correct
9 Correct 8 ms 2908 KB Output is correct
10 Correct 9 ms 2908 KB Output is correct
11 Correct 8 ms 2652 KB Output is correct
12 Correct 8 ms 2652 KB Output is correct
13 Correct 8 ms 2836 KB Output is correct
14 Correct 11 ms 2916 KB Output is correct
15 Correct 10 ms 2920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 11860 KB Output is correct
2 Correct 73 ms 11600 KB Output is correct
3 Correct 72 ms 11936 KB Output is correct
4 Correct 71 ms 11860 KB Output is correct
5 Correct 107 ms 12220 KB Output is correct
6 Correct 1 ms 2788 KB Output is correct
7 Correct 17 ms 2912 KB Output is correct
8 Correct 1594 ms 4660 KB Output is correct
9 Execution timed out 5567 ms 17848 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 11860 KB Output is correct
2 Correct 73 ms 11600 KB Output is correct
3 Correct 72 ms 11936 KB Output is correct
4 Correct 71 ms 11860 KB Output is correct
5 Correct 107 ms 12220 KB Output is correct
6 Correct 2 ms 2784 KB Output is correct
7 Correct 24 ms 2988 KB Output is correct
8 Correct 2522 ms 5184 KB Output is correct
9 Execution timed out 5541 ms 23320 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 11860 KB Output is correct
2 Correct 73 ms 11600 KB Output is correct
3 Correct 72 ms 11936 KB Output is correct
4 Correct 71 ms 11860 KB Output is correct
5 Correct 107 ms 12220 KB Output is correct
6 Correct 2 ms 2648 KB Output is correct
7 Correct 5 ms 2652 KB Output is correct
8 Correct 7 ms 2652 KB Output is correct
9 Correct 8 ms 2908 KB Output is correct
10 Correct 9 ms 2908 KB Output is correct
11 Correct 9 ms 2908 KB Output is correct
12 Correct 9 ms 2908 KB Output is correct
13 Correct 8 ms 2908 KB Output is correct
14 Correct 8 ms 2908 KB Output is correct
15 Correct 9 ms 2908 KB Output is correct
16 Correct 8 ms 2652 KB Output is correct
17 Correct 8 ms 2652 KB Output is correct
18 Correct 8 ms 2836 KB Output is correct
19 Correct 11 ms 2916 KB Output is correct
20 Correct 10 ms 2920 KB Output is correct
21 Correct 1 ms 2788 KB Output is correct
22 Correct 17 ms 2912 KB Output is correct
23 Correct 1594 ms 4660 KB Output is correct
24 Execution timed out 5567 ms 17848 KB Time limit exceeded
25 Halted 0 ms 0 KB -