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 f first
#define s second
#define mn(a,b) min(a,b)
#define mx(a,b) max(a,b)
#define ll long long
vector<pair<int,int>>G[int(1e5)];
double My_Num = 0;
int ok = 0 ;
void dfs(int x,int p,int h){
if(x == h){
ok = 1;
return;
}
for(auto u : G[x]){
if(u.f==p)continue;
My_Num+=u.s;
dfs(u.f,x,h);
if(ok)return;
My_Num-=u.s;
}
}
double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int>
y, std::vector<int> c, std::vector<int> arr){
for(int i = 0 ; i < M ;i++){
G[x[i]].push_back({y[i],c[i]});
G[y[i]].push_back({x[i],c[i]});
}
dfs(0,-1,H);
return My_Num;
}
# | 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... |
# | 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... |