답안 #48435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48435 2018-05-13T12:09:43 Z aleksami Commuter Pass (JOI18_commuter_pass) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define MAXN 100005
#define INF 1000000000000000
typedef pair<ll,ll> pii;
vector <pii> g[MAXN];
bool gotov[MAXN];
priority_queue <pii> pq;
int n,m;

void dijkstra(ll *d,int source)
{
	for(int i = 0; i < MAXN; i++)d[i]=INF,gotov[i]=false;
	d[source]=0;
	pq.push({-d[source],source});
	while(!pq.empty())
	{
		int v = pq.top().second;
		pq.pop();
		if(gotov[v])continue;
		gotov[v]=1;
		for(auto x:g[v])
		{
			int u = x.first;
			int c = x.second;
			if(d[u]>d[v]+c)d[u]=d[v]+c,pq.push({-d[u],u});
		}
	}
}
ll ds[MAXN];
ll dt[MAXN];
ll du[MAXN];
ll dv[MAXN];
ll d1[MAXN];
ll d2[MAXN];
int s,t;

void dijkstraa(ll *d,int *dd)
{
	for(int i = 0; i < MAXN; i++)gotov[i]=false,dd[i]=d[i],pq.push({-dd[i],i});
	while(!pq.empty())
	{
		int v = pq.top().second;
		pq.pop();
		if(gotov[v])continue;
		gotov[v]=1;
		for(auto x:g[v])
		{
			int u = x.first;
			int c = x.second;
			if( ds[u]+c+dt[v]==ds[t] && dd[u]>dd[v])dd[u]=dd[v],pq.push({-dd[u],u});
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	int u,v;
	cin >> n >> m >> s >> t >> u >> v;
	for(int i = 0; i < m; i++)
	{
		int x,y,c;
		cin >> x >> y >> c;
		g[x].push_back({y,c});
		g[y].push_back({x,c});
	}
	dijkstra(ds,s);
	dijkstra(dt,t);
	dijkstra(du,u);
	dijkstra(dv,v);
	dijkstraa(dv,d1);
	dijkstraa(du,d2);
	ll ans = INF;
	for(int i = 1; i <= n; i++)
	{
		ans=min(ans,du[i]+d1[i]);
		ans=min(ans,dv[i]+d2[i]);
	}
	cout << ans;
	return 0;
}

Compilation message

commuter_pass.cpp: In function 'int main()':
commuter_pass.cpp:74:17: error: cannot convert 'll* {aka long long int*}' to 'int*' for argument '2' to 'void dijkstraa(ll*, int*)'
  dijkstraa(dv,d1);
                 ^
commuter_pass.cpp:75:17: error: cannot convert 'll* {aka long long int*}' to 'int*' for argument '2' to 'void dijkstraa(ll*, int*)'
  dijkstraa(du,d2);
                 ^