Submission #988196

# Submission time Handle Problem Language Result Execution time Memory
988196 2024-05-24T09:49:31 Z BF001 Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define NN 100005
#define int long long
#define oo 1e18
#define fi first
#define se second

typedef pair<int, int> ii;

int n, m, k, d1[NN], d2[NN];
vector<int> sr;
vector<ii> adj[NN];

int ditra(){
	for (int i = 1; i <= n; i++) d1[i] = d2[i] = oo;
	priority_queue<ii, vector<ii>, greater<ii>> q;
	for (auto x : sr){
		d2[x] = d1[x] = 0;
		q.push({0, x});
	}
	while (!q.empty()){
		int u = q.top().se;
		int du = q.top().fi;
		q.pop();
		if (du != d2[u]) continue;
		for (auto x : adj[u]){
			int v = x.fi;
			int dv = x.se;
			if (du + dv < d1[v]){
				d2[v] = d1[v];
				d1[v] = du + dv;
				q.push({d2[v], v});
			}
			else if (du + dv < d2[v]){
				d2[v] = du + dv;
				q.push({d2[v], v});
			}
		}
	}
	return d2[0];
}

int travel_plan(int N, int M , int R[][2], int L[], int k, int p[]){
	n = N;
	m = M;
	for (int i = 0; i < m; i++){
		int a = R[i][0], b = R[i][1], c = L[i];
		adj[a].push_back({b, c});
		adj[b].push_back({a, c}); 
	}
	for (int i = 0; i < k; i++){
		sr.push_back(p[i]);
	}
	return ditra();
}

Compilation message

/usr/bin/ld: /tmp/ccaPMaHe.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