제출 #696354

#제출 시각아이디문제언어결과실행 시간메모리
696354esomer기지국 (IOI20_stations)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define endl "\n" typedef long long int ll; const int MOD = 1e9 + 7; vector<int> ans; int cnt; void DFS(int x, vector<vector<int>>& adj, int p, int d){ if(d%2 == 0) {ans[x] = cnt; cnt++;} for(int node : adj[x]){ if(node != p) DFS(node, adj, x, d + 1); } if(d%2 == 1){ans[x] = cnt; cnt++;} } vector<int> label(int n, int k, int* u, int* v){ vector<vector<int>> adj(n); cnt = 0; ans.resize(n); for(int i = 0; i < n - 1; i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } DFS(0, adj, -1, 0); return ans; } int find_next_station(int s, int t, vector<int> c){ bool st = 1; if(s > c[0]) st = 0; int n = (int)c.size(); int start = s; for(int i = 0; i < n; i++){ if(st == 0 && i == 0) continue; else if(st == 1 && i == n - 1) continue; if(st == 1){ if(t > start && t <= c[i]){ return c[i]; }else start = c[i]; }else{ if(i == n - 1){ if(t >= c[i] && t < s) return c[i]; }else{ if(t >= c[i] && t < c[i + 1]){ return c[i]; } } } } if(st == 0) return c[0]; else return c[n - 1]; }

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

/usr/bin/ld: /tmp/cc6WCHAJ.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> >)'
collect2: error: ld returned 1 exit status