#include <bits/stdc++.h>
#include "crocodile.h"
using namespace std;
#define MAX_N 50000
#define MAX_M 10000000
vector<pair<int, long long>> adj[MAX_N];
long long dis[MAX_N];
int vis[MAX_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]].emplace_back(R[i][1], L[i]);
adj[R[i][1]].emplace_back(R[i][0], L[i]);
}
priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> pq;
for(int i = 0; i < K; ++i){
vis[P[i]] = 1;
pq.emplace(0LL, P[i]);
}
while(!pq.empty()){
auto [d, u] = pq.top(); pq.pop();
vis[u]++;
if(vis[u] == 2){
dis[u] = d;
for(auto [v, w] : adj[u]) pq.emplace(d + w, v);
}
}
return dis[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4432 KB |
Output is correct |
2 |
Correct |
1 ms |
4432 KB |
Output is correct |
3 |
Correct |
1 ms |
4600 KB |
Output is correct |
4 |
Correct |
1 ms |
4432 KB |
Output is correct |
5 |
Correct |
2 ms |
4432 KB |
Output is correct |
6 |
Correct |
1 ms |
4432 KB |
Output is correct |
7 |
Correct |
2 ms |
4432 KB |
Output is correct |
8 |
Correct |
1 ms |
4432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4432 KB |
Output is correct |
2 |
Correct |
1 ms |
4432 KB |
Output is correct |
3 |
Correct |
1 ms |
4600 KB |
Output is correct |
4 |
Correct |
1 ms |
4432 KB |
Output is correct |
5 |
Correct |
2 ms |
4432 KB |
Output is correct |
6 |
Correct |
1 ms |
4432 KB |
Output is correct |
7 |
Correct |
2 ms |
4432 KB |
Output is correct |
8 |
Correct |
1 ms |
4432 KB |
Output is correct |
9 |
Correct |
4 ms |
5200 KB |
Output is correct |
10 |
Correct |
1 ms |
4432 KB |
Output is correct |
11 |
Correct |
3 ms |
4688 KB |
Output is correct |
12 |
Correct |
6 ms |
5764 KB |
Output is correct |
13 |
Correct |
5 ms |
5720 KB |
Output is correct |
14 |
Correct |
1 ms |
4600 KB |
Output is correct |
15 |
Correct |
2 ms |
4852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4432 KB |
Output is correct |
2 |
Correct |
1 ms |
4432 KB |
Output is correct |
3 |
Correct |
1 ms |
4600 KB |
Output is correct |
4 |
Correct |
1 ms |
4432 KB |
Output is correct |
5 |
Correct |
2 ms |
4432 KB |
Output is correct |
6 |
Correct |
1 ms |
4432 KB |
Output is correct |
7 |
Correct |
2 ms |
4432 KB |
Output is correct |
8 |
Correct |
1 ms |
4432 KB |
Output is correct |
9 |
Correct |
4 ms |
5200 KB |
Output is correct |
10 |
Correct |
1 ms |
4432 KB |
Output is correct |
11 |
Correct |
3 ms |
4688 KB |
Output is correct |
12 |
Correct |
6 ms |
5764 KB |
Output is correct |
13 |
Correct |
5 ms |
5720 KB |
Output is correct |
14 |
Correct |
1 ms |
4600 KB |
Output is correct |
15 |
Correct |
2 ms |
4852 KB |
Output is correct |
16 |
Correct |
613 ms |
117688 KB |
Output is correct |
17 |
Runtime error |
52 ms |
20304 KB |
Execution killed with signal 11 |
18 |
Halted |
0 ms |
0 KB |
- |