이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cyberland.h"
#include<bits/stdc++.h>
#include <vector>
#define ll long long
using namespace std;
int h;
vector<int>a;
vector<vector<array<int,2>>>v;
ll dfs(int x,int p,ll c){
if(x==h) return c;
if(a[x]==0) c=0;
for(auto [y,z]:v[x]){
if(y!=p){
ll ans=dfs(y,x,c+z);
if(ans!=-1) return ans;
}
}
return -1;
}
double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
v.assign(N,vector<array<int,2>>(0));
a.resize(N);
for(int i=0;i<N;i++) a[i]=arr[i];
h=H;
for(int i=0;i<M;i++){
v[x[i]].push_back({y[i],c[i]});
v[y[i]].push_back({x[i],c[i]});
}
double ans=dfs(0,0,0);
return ans;
}
# | 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... |