#include <bits/stdc++.h>
//#include "crocodile.h"
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll long long
#define loop(i, a, b) for(ll i=a;i<b;i++)
#define pool(i, a, b) for(ll i=a-1;i>=b;i--)
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 200100
#define pa pair<ll, ll>
#define ld long double
vc<pa> edg[mn];
ll act[mn], dist[mn], vis[mn];
int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){
loop(i, 0, n) dist[i]=-1;
loop(i, 0, m){
edg[r[i][0]].ps(make_pair(r[i][1], l[i]));
edg[r[i][1]].ps(make_pair(r[i][0], l[i]));
}
set<pair<ll, ll>> q;loop(i, 0, k) q.insert({0, p[i]}), act[p[i]]=1, dist[p[i]]=0;
while(q.size()){
ll u=q.begin()->se, d=q.begin()->fi;
q.erase(q.begin());
if(vis[u])continue;
if(!act[u]) act[u]=1;
else{
vis[u]=1;
dist[u]=d;
fore(v, edg[u]) q.insert({dist[u]+v.se, v.fi});
}
}
return dist[0];
}
int main(){
ll n, m, k;cin >> n >> m >> k;
ll r[m][2], l[m], p[k];
loop(i, 0, m) cin >> r[i][0]>>r[i][1];
loop(i, 0, m) cin >> l[i];
loop(i, 0, k) cin >> p[i];
cout << travel_plan(n, m, r, l, k, p)<<endl;
}
Compilation message
crocodile.cpp: In function 'int main()':
crocodile.cpp:52:31: error: cannot convert 'long long int (*)[2]' to 'int (*)[2]'
52 | cout << travel_plan(n, m, r, l, k, p)<<endl;
| ^
| |
| long long int (*)[2]
crocodile.cpp:25:33: note: initializing argument 3 of 'int travel_plan(int, int, int (*)[2], int*, int, int*)'
25 | int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){
| ~~~~^~~~~~