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;
vector<pair<int,int> > G[100005];
double rez=0;
void dfs(int teme, int kraj, int p, double vreme) {
if (teme==kraj) {
rez=vreme;
return;
}
for (auto x:G[teme]) {
int next=x.first;
if (p!=next)
dfs(next, kraj, teme, vreme+x.second);
}
}
double solve(int n, int m, int k, int h, vector<int> a, vector<int> b, vector<int> c, vector<int> arr) {
for(int i=0;i<n;i++)
G[i].clear();
for (int i=0;i<m;i++) {
G[a[i]].push_back({b[i],c[i]});
G[b[i]].push_back({a[i],c[i]});
}
dfs(0,h,-1,0);
return rez;
}
# | 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... |