이 제출은 이전 버전의 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, std::vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
swap(a,arr);
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... |