제출 #971427

#제출 시각아이디문제언어결과실행 시간메모리
971427Nomio사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, m, k, h;
	cin >> n >> m >> k >> h;
	vector<pair<int, int>> v[n];
	while(m--) {
		int x, y, c;
		cin >> x >> y >> c;
		v[x].push_back({y, c});
		v[y].push_back({x, c});
	}
	vector<bool> V(n, 0);
	for(int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if(a == 0) {
			V[i] = 1;
		}
	}
	priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
	vector<ll> dis(n, 1e18);
	dis[0] = 0;
	pq.push({0, 0});
	while(!pq.empty()) {
		ll x = pq.top().first;
		int y = pq.top().second;
		pq.pop();
		if(dis[y] != x) continue;
		for(pair<int, int> p : v[y]) {
			int X = p.first;
			int Y = p.second;
			if(V[X] && dis[X] != 0) {
				dis[X] = 0;
				pq.push({0, X});	
			} else if(dis[X] > dis[y] + Y) {
				dis[X] = dis[y] + Y;
				pq.push({dis[X], X});
			}
		}
	}
	if(dis[h] == 1e18) {
		cout << -1 << '\n';
	} else {
		cout << dis[h] << '\n';
	}
	return 0;
}

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

/usr/bin/ld: /tmp/cchVzObA.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cceZh5Ay.o:cyberland.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cchVzObA.o: in function `main':
grader.cpp:(.text.startup+0x696): undefined reference to `solve(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status