#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 |
1 |
Incorrect |
13 ms |
856 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
1372 KB |
Double -1.40446e+09 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
1628 KB |
Double -2.12228e+09 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
810 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1122 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
920 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
868 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
878 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |