제출 #926925

#제출 시각아이디문제언어결과실행 시간메모리
926925daoquanglinh2007기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define isz(a) (int)(a).size() const int NM = 1000; vector <int> adj[NM+5]; int dep[NM+5]; int timer = 0, tin[NM+5], tout[NM+5]; vector <int> arr; void dfs(int u, int p){ dep[u] = (p == -1 ? 0 : dep[p]+1); tin[u] = ++timer; for (int v : adj[u]){ if (v == p) continue; dfs(v, u); } tout[u] = ++timer; } vector <int> label(int n, int k, vector <int> &u, vector <int> &v){ for (int i = 0; i < n-1; i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0, -1); for (int i = 0; i < n; i++){ if (dep[i]&1) arr.push_back(tout[i]); else arr.push_back(tin[i]); } sort(arr.begin(), arr.end()); vector <int> ans(n); for (int i = 0; i < n; i++){ if (dep[i]&1) ans[i] = lower_bound(arr.begin(), arr.end(), tout[i])-arr.begin(); else ans[i] = lower_bound(arr.begin(), arr.end(), tin[i])-arr.begin(); } return ans; } int find_next_station(int s, int t, vector <int> &c){ if (s < c.front()){ if (t < s || t > c.back()) return c.back(); for (int i = 0; i+1 < isz(c); i++) if (c[i] >= t) return c[i]; return -1; } else{ if (t < c.front() || t > s) return c.front(); for (int i = isz(c)-1; i > 0; i--) if (c[i] <= t) return c[i]; return -1; } }

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

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