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>
#include "cyberland.h"
using namespace std;
#define ll long long
const int N=100000;
vector<pair<int,ll>> edges[N];
bool visited[N]={};
double ans=0;
double fans;
void dfs(int u,int h){
if(u==h){
fans=ans;
}
for(auto v:edges[u]){
if(!visited[v.first]){
visited[v.first]=true;
ans+=v.second;
dfs(v.first,h);
ans-=v.second;
}
}
}
double solve(int n,int m,int k,int h,vector<int> x,vector<int> y,vector<int> c,vector<int> a){
ans=0;
fans=0;
for(int i=0;i<m;i++){
edges[x[i]].push_back(make_pair(y[i],(ll) c[i]));
edges[y[i]].push_back(make_pair(x[i],(ll) c[i]));
}
visited[0]=true;
dfs(0,h);
for(int i=0;i<n;i++){
edges[i].clear();
visited[i]=false;
}
return fans;
}
# | 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... |