This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int mxN = 1005;
const int INF = (int)1e9;
vector<pair<int,int>> adj[mxN];
int find(int src,int k){
if(k<0) return INF;
if(k==0) return 0;
int ans=INF;
for(auto it:adj[src]){
ans=min(ans,find(it.first,k-it.second)+1);
}
return ans;
}
int best_path(int n,int k,int h[][2],int l[]){
for(int i=0;i<n-1;++i){
adj[h[i][0]].pb({h[i][1],l[i]});
adj[h[i][1]].pb({h[i][0],l[i]});
}
int ans=INF;
if(ans==INF) return -1;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |