#include "race.h"
#include<bits/stdc++.h>
using namespace std;
const int M=2e5+5;
int ans=INT_MAX;
vector<pair<int,int>>v[M];
#define pb push_back
#define ff first
#define ss second
bool vis[M];
int Z;
vector<int> fun(int a){
vis[a]=1;
vector<int>dp(150);
for(int i=0;i<=Z;i++)dp[i]=INT_MAX;
dp[0]=0;
for(auto p:v[a]){
int b=p.ff;
int c=p.ss;
if(vis[b]==0){
vector<int>vc=fun(b);
for(int i=0;i<=Z;i++){
ans=min(ans,dp[i]+vc[Z-i]+2);
}
for(int i=0;i<=Z-c;i++){
dp[i+c]=min(dp[i+c],vc[i]+1);
}
}
}
ans=min(ans,dp[Z]);
return dp;
}
int best_path(int N, int K, int H[][2], int L[]){
Z=K;
for(int i=0;i<N-1;i++)cin>>H[i][0]>>H[i][1];
for(int i=0;i<N-1;i++)cin>>L[i];
for(int i=0;i<N-1;i++){
int a=H[i][0];
int b=H[i][1];
int c=L[i];
v[a].pb({b,c});
v[b].pb({a,c});
}
fun(0);
if(ans==INT_MAX)return -1;
return ans;
}
Compilation message
joi2019_ho_t1.cpp:1:10: fatal error: race.h: No such file or directory
1 | #include "race.h"
| ^~~~~~~~
compilation terminated.