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