Submission #1081336

# Submission time Handle Problem Language Result Execution time Memory
1081336 2024-08-29T23:47:01 Z nrg_studio Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define pii pair<ll,ll>
#define f first
#define s second
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)

int main() {
	ios::sync_with_stdio(false); cin.tie(0);

	int n, m, k, a, b, w; cin >> n >> m >> k;
	vector<vector<pii>> adj(n);
	F0R(i,m) {
		cin >> a >> b >> w;
		adj[a].pb({b,w});
		adj[b].pb({a,w});
	}
	vector<pii> mn(n,{LLONG_MAX,LLONG_MAX});
	priority_queue<pii,vector<pii>,greater<pii>> pq;
	F0R(i,k) {
		cin >> a; 
		 mn[a] = {0,0};
		pq.push({0,a});
	}
	while (pq.size()) {
		pii cur = pq.top(); pq.pop();
		if (cur.f != mn[cur.s].s) {continue;}

		for (pii qwerty : adj[cur.s]) {
			int cand = qwerty.s+cur.f, x = qwerty.f;
			if (cand < mn[x].s) {
				if (cand <= mn[x].f) {
					mn[x].s = mn[x].f; mn[x].f = cand;	
				} else {mn[x].s = cand;}
				pq.push({mn[x].s,x});
			}
		}
	} cout << mn[0].s << '\n';
}

Compilation message

/usr/bin/ld: /tmp/ccJTboCK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWwfYEH.o:crocodile.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccJTboCK.o: in function `main':
grader.cpp:(.text.startup+0x36): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status