#include "bits/stdc++.h"
#include "crocodile.h"
#define i64 long long
using namespace std;
const i64 sz = 1e5 + 5;
vector<vector<i64>> aj[sz];
i64 d[sz];
void dfs(int v, int p = -1, i64 l = 0) {
d[v] = l;
for (auto& u : aj[v]) {
int to = u[0];
int we = u[1];
if (to != p) {
dfs(to, v, l + we);
}
}
}
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
for (int i = 0; i < M; i ++) {
int a = R[i][0];
int b = R[i][1];
aj[a].push_back({b, L[i]});
aj[b].push_back({a, L[i]});
}
dfs(0);
i64 mx = 0;
for (int i = 0; i < K; i ++) {
if (d[P[i]]) {
mx = max(mx, d[P[i]]);
}
}
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |