제출 #1329331

#제출 시각아이디문제언어결과실행 시간메모리
1329331paronmanukyan악어의 지하 도시 (IOI11_crocodile)C++20
컴파일 에러
0 ms0 KiB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define uniq(x) x.resize(unique(all(x)) - x.begin());
#define sort_uniq(x) sort(all(x)), uniq(x);
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<int, int>
#define V vector
#define V2dll V<V<int>>
#define V2dchar V<V<char>>
#define V2dbool V<V<bool>>
#define V3dll V<V<V<int>>>
#define V3dchar V<V<V<char>>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define FASTIO                         \
  ios_base::sync_with_stdio(false);    \
  cin.tie(nullptr);                    \
  cout.tie(nullptr);
#define INF INT_MAX
#define blt __builtin_popcount
#define clr(x) x.clear()
#define ff first
#define ss second
#define popf pop_front
#define popb pop_back
#define sz(x) int(x.size())
#define rep(a, b, c, d) for (int a = b; a <= c; a += d)
#define repl(a, b, c, d) for (int a = b; a >= c; a -= d)

const int N = 1e5 + 5;
V<pll> adj[N];
ll dp[N], bst[N];

ll travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
	int n = N, m = M;
	rep(i, 0, M - 1, 1) {
		int x = R[i][0] + 1, y = R[i][1] + 1;
		ll w = L[i];
		adj[x].pb({ y, w });
		adj[y].pb({ x, w });
	}

	priority_queue<pii, V<pii>, greater<pii>> pq;
	function<void(int)> update = [&](int node) -> void {
		ll w = dp[node];
		//cout << node << " " << dp[node] << endl;
		for (auto bs : adj[node]) {
			ll i = bs.ff, val = bs.ss;
			if (w + val < dp[i]) {
				if (w + val < bst[i]) {
					dp[i] = bst[i];
					bst[i] = w + val;
				}
				else {
					dp[i] = w + val;
				}
				if (dp[i] < 1e9)
				  pq.push({ dp[i], i });
			}
		}
		return;
	};

	rep(i, 1, n, 1) {
		dp[i] = bst[i] = 1e17;
	}
	rep(i, 0, K - 1, 1)
		dp[P[i] + 1] = 0, bst[P[i] + 1] = 0;

	rep(i, 0, K - 1, 1)
		pq.push({ 0, P[i] + 1 });
	while (!pq.empty()) {
		auto it = pq.top();
		pq.pop();
		ll w = it.ff;
		int node = it.ss;
		if (w != dp[node])
			continue;
		update(node);
	}
	return dp[1];
}

컴파일 시 표준 에러 (stderr) 메시지

crocodile.cpp:42:4: error: ambiguating new declaration of 'long long int travel_plan(int, int, int (*)[2], int*, int, int*)'
   42 | 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[]);
      |     ^~~~~~~~~~~