Submission #1085024

# Submission time Handle Problem Language Result Execution time Memory
1085024 2024-09-07T10:16:06 Z ZeroCool Stations (IOI20_stations) C++14
Compilation error
0 ms 0 KB
#include "stations.h"#include <vector>#include <bits/stdc++.h> using namespace std; const int N = 1000; vector<int> g[N];vector<int> A; int T = 0;void dfs(int x,int p, bool b){	if(b){		for(auto u: g[x]){			if(u == p)continue;			dfs(u, x, !b);		}		A[x] = T++;	}else{		A[x] = T++;		for(auto u: g[x]){			if(u == p)continue;			dfs(u, x, !b);		}	}} std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {	T = 0;	A.clear();	A.resize(n);	for(int i = 0;i < n;i++)g[i].clear();	for(int i = 0;i < n- 1;i ++){		g[u[i]].push_back(v[i]);		g[v[i]].push_back(u[i]);	}	dfs(0, 0,0 );	return A;} int find_next_station(int s, int t, std::vector<int> g) {	if(g.size() == 1)return g.front();	sort(g.begin(), g.end());	if(s > g.front()){		if(t > s || t <= g.front())return g.front();		return *(upper_bound(g.begin(), g.end(), t) - 1);	}else{		if(t < s | t >= g.back())return g.back();		return *lower_bound(g.begin(), g.end(), t);	}}

Compilation message

stations.cpp:1:22: warning: extra tokens at end of #include directive
    1 | #include "stations.h"#include <vector>#include <bits/stdc++.h> using namespace std; const int N = 1000; vector<int> g[N];vector<int> A; int T = 0;void dfs(int x,int p, bool b){ if(b){  for(auto u: g[x]){   if(u == p)continue;   dfs(u, x, !b);  }  A[x] = T++; }else{  A[x] = T++;  for(auto u: g[x]){   if(u == p)continue;   dfs(u, x, !b);  } }} std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { T = 0; A.clear(); A.resize(n); for(int i = 0;i < n;i++)g[i].clear(); for(int i = 0;i < n- 1;i ++){  g[u[i]].push_back(v[i]);  g[v[i]].push_back(u[i]); } dfs(0, 0,0 ); return A;} int find_next_station(int s, int t, std::vector<int> g) { if(g.size() == 1)return g.front(); sort(g.begin(), g.end()); if(s > g.front()){  if(t > s || t <= g.front())return g.front();  return *(upper_bound(g.begin(), g.end(), t) - 1); }else{  if(t < s | t >= g.back())return g.back();  return *lower_bound(g.begin(), g.end(), t); }}
      |                      ^
/usr/bin/ld: /tmp/cc0kPq5K.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