Submission #672852

#TimeUsernameProblemLanguageResultExecution timeMemory
672852vjudge1Stations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int labels[N], cnt;
int* label(int n, int k, int* u, int* v);
int find_next_station(int s, int t, int* c);

/*
clarifications:
k == n-1
c is sorted

*/

vector<vector<int>> g;
void dfs(int node, int par) {
	labels[node] = cnt++;
	for (int ch : g[node]) {
		if (ch != par) {
			dfs(ch, node);
		}
	}
}

int* label(int n, int k, int* u, int* v) {
	g.clear();
	g.resize(n);
	for (int i = 0; i < n - 1;i++) {
		g[u[i]].push_back(v[i]);
		g[v[i]].push_back(u[i]);
	}
	cnt = 0;
	dfs(0, -1);
	return labels;
}

int find_next_station(int s, int t, int* c) {
	int sz = sizeof c;
	if (t <= c[0]) return c[0];
	for (int i = 1; i < sz-1; i++) {
		if (t >= c[i] && t < c[i + 1]) return c[i];
	}
	return c[sz - 1];
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cceoO3mU.o: in function `main':
stub.cpp:(.text.startup+0x2b5): undefined reference to `label(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: stub.cpp:(.text.startup+0x4cc): undefined reference to `find_next_station(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status