답안 #1004495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1004495 2024-06-21T09:27:42 Z vjudge3 악어의 지하 도시 (IOI11_crocodile) C++17
컴파일 오류
0 ms 0 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

vector<pair<int, ll>> g[100005];
ll di[100005][2];
const ll inf = 1e18;

ll travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
	for (int i = 0; i < N; i++) di[i][0] = di[i][1] = inf;
	for (int i = 0; i < M; i++) {
		g[R[i][0]].push_back({R[i][1], L[i]});
		g[R[i][1]].push_back({R[i][0], L[i]});
	}
	using T = pair<ll, ll>;
	priority_queue<T, vector<T>, greater<T>> pq;
	for (int i = 0; i < K; i++) {
		pq.push({0, P[i]});
		di[P[i]][0] = di[P[i]][1] = 0;
	}
	while (!pq.empty()) {
		auto [d, u] = pq.top();
		pq.pop();
		if (di[u][1] != d) continue;
		for (auto& [v, w] : g[u]) {
			if (d+w <= di[v][0]) {
				di[v][1] = di[v][0];
				di[v][0] = d+w;
				if (di[v][1] != inf) pq.push({di[v][1], v});
			} else if (d+w < di[v][1]) {
				di[v][1] = d+w;
				pq.push({di[v][1], v});
			}
		}
	}
	return di[0][1];
}

Compilation message

crocodile.cpp:10:4: error: ambiguating new declaration of 'll travel_plan(int, int, int (*)[2], int*, int, int*)'
   10 | ll travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
      |    ^~~~~~~~~~~
In file included from crocodile.cpp:1:
crocodile.h:1:5: note: old declaration 'int travel_plan(int, int, int (*)[2], int*, int, int*)'
    1 | int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]);
      |     ^~~~~~~~~~~