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"crocodile.h"
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
vector<pair<int,int>>g[1005];
bool vis[1005];
int dfs(int v,int p){
if(vis[v])return 0;
multiset<int>st;
for(auto to:g[v])
if(to.fr!=p)
st.insert(dfs(to.fr,v)+to.sc);
st.erase(st.begin());
return *st.begin();
}
int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){
for(int i=0;i<m;i++){
g[r[i][0]].push_back({r[i][1],l[i]});
g[r[i][1]].push_back({r[i][0],l[i]});
}
for(int i=0;i<k;i++)vis[p[i]]=1;
return dfs(0,0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |