//Suleyman Atayew
#include "crocodile.h"
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <bitset>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#define maxN 200010
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define mod 1000000007
#define pii pair <int, int>
#define sz(a) (int)(a.size())
ll bigmod(ll a, ll b) { if(b==0)return 1; ll ret = bigmod(a, b/2); return ret * ret % mod * (b%2 ? a : 1) % mod; }
using namespace std;
int n, m, k;
int vis[maxN], dis[maxN];
vector <pii> E[maxN];
priority_queue <pii> Q;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
n = N, m = M, k = K;
for(int i = 0; i < m; i++) {
int a = R[i][0], b = R[i][1], c = L[i];
E[a].pb({b, c});
E[b].pb({a, c});
}
for(int i = 0; i < n; i++) dis[i] = 1e9;
for(int i = 0; i < k; i++) {
int x = P[i];
Q.push({0, x});
vis[x] = 1, dis[x] = 0;
}
while(!Q.empty()) {
int nd = Q.top().ff;
Q.pop();
if(vis[nd] == 2) continue;
vis[nd]++;
if(vis[nd] == 1) {
dis[nd] = 1e9;
continue;
}
for(auto i: E[nd]) {
int to = i.ff;
int w = i.ss;
if(vis[to] == 2) continue;
if(dis[to] > dis[nd]+w) {
dis[to] = dis[nd]+w;
Q.push({-dis[to], to});
}
}
}
return dis[n];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
4940 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
4940 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
4940 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |