이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |