#include "crocodile.h"
#include <vector>
using namespace std;
using ll = long long int;
vector<pair<int,ll>> g[100100];
ll dist[100100] = {0};
void dfs(int node, int prev = -1){
for(auto i : g[node]){
if(i.first != prev){
dist[i.first] = dist[node] + i.second;
dfs(i.first, node);
}
}
}
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
for(int i = 0; i < M; ++i){
g[R[i][0]].push_back({R[i][1], L[i]});
g[R[i][1]].push_back({R[i][0], L[i]});
}
dfs(0);
ll ans = 0;
for(int i = 0; i < K; ++i){
ans = max(ans, dist[P[i]]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |