제출 #889623

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
8896232023-12-20 04:01:12asdfgrace경주 (Race) (IOI11_race)C++17
0 / 100
13 ms51344 KiB
#include <bits/stdc++.h>
#include "race.h"
using namespace std;
/*
start at the centroid
consider all paths whose lca is the centroid of the tree
try solving each of these in o(n)?
can we knapsack?
consider root & sum of weights on paths to each node
do a dfs
then for each node
search for a matching path
*/
multiset<int> at[1000010];
int best_path(int N, int K, int H[][2], int L[]) {
int ans = 1e9;
vector<vector<pair<int, int>>> edges(N);
for (int i = 0; i < N - 1; i++) {
edges[H[i][0]].push_back({H[i][1], L[i]});
edges[H[i][1]].push_back({H[i][0], L[i]});
}
at[0].insert(0);
vector<int> sz(N, 1), val(N, 0), dep(N, 0);
vector<bool> visited(N, false);
function<void(int, int)> dfs_sz = [&] (int node, int par) {
sz[node] = 1;
for (auto [next, wt] : edges[node]) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...