#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100001;
const ll M = 2000000000000000000LL;
vector<array<int, 2>> adj[N];
vector<array<ll, 2>> path(N, {M, M});
bool vis[N];
int travel_plan(int n, int m, int r[][2], int l[], int k, int p[])
{
for (int i = 0; i < m; i++)
{
adj[r[i][0]].push_back({r[i][1], l[i]});
adj[r[i][1]].push_back({r[i][0], l[i]});
}
priority_queue<array<ll, 2>> pq;
for (int i = 0; i < k; i++)
{
int node = p[i];
path[node] = {0, 0};
pq.push({0, node});
}
while (!pq.empty())
{
int node = pq.top()[1];
ll dist = pq.top()[0];
pq.pop();
if (vis[node]) continue;
vis[node] = true;
for (auto next : adj[node])
{
if (vis[next[0]]) continue;
array<ll, 3> ar {path[next[0]][0], path[next[0]][1], dist + next[1]};
sort(ar.begin(), ar.end());
path[next[0]][0] = ar[0];
path[next[0]][1] = ar[1];
if (path[next[0]][1] != M) pq.push({path[next[0]][1], next[0]});
}
}
return path[0][1];
}
///home/domen/Downloads/crocodile/crocodile.cpp|19|error: request for member ‘push_back’ in ‘(*(r + ((sizetype)(((long unsigned int)i) * 8))))[1]’, which is of non-class type ‘int’|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
4204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
4204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
4204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |