#include "crocodile.h"
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define f first
#define s second
#define pb push_back
#define p_b pop_back
using namespace std;
const int sz = 1e3+5;
vector<pii>g[sz];
int vis[sz], dist[sz];
void dfs(int node)
{
vis[node] = 1;
for(auto u : g[node])
{
if(vis[u.f])
continue;
dist[u.f] = dist[node] + u.s;
dfs(u.f);
}
}
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]].pb({R[i][1], L[i]});
g[R[i][1]].pb({R[i][0], L[i]});
}
int res = 0;
dfs(0);
for(int i = 0; i < K; i++)
res = max(res, dist[P[i]]);
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |