제출 #957842

#제출 시각아이디문제언어결과실행 시간메모리
957842MisterReaper경주 (Race) (IOI11_race)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <race.h> using i64 = long long; constexpr int maxN = 2E5 + 5; int n, k; std::map<i64, int> s[maxN]; std::vector<std::pair<int, int>> adj[maxN]; int h[maxN], d[maxN]; int ans = maxN; void dfs(int node, int par) { for(auto [child, w] : adj[node]) { if(child == par) { continue; } h[child] = h[node] + w; d[child] = d[node] + 1; dfs(child, node); } return; } void s2l(int node, int par) { i64 target = k + h[node] * 2; s[node][h[node]] = d[node]; for(auto [child, w] : adj[node]) { if(child == par) { continue; } s2l(child, node); if(s[child].size() > s[node].size()) { std::swap(s[child], s[node]); } for(auto [a, b] : s[child]) { if(s[node].count(target - a)) { ans = std::min(ans, s[node][target - a] + b - 2 * d[node]); } } for(auto [a, b] : s[child]) { if(!s[node].count(a)) { s[node][a] = n; } s[node][a] = std::min(s[node][a], b); } } /* std::cerr << "node: " << node << "\n"; for(auto [a, b] : s[node]) { std::cerr << a << " " << b << "\n"; } */ } int bestpath(int N, int K, int H[][2], int L[]) { n = N; k = K; for(int i = 0; i < n - 1; i++) { //std::cerr << H[i][0] << " " << H[i][1] << " :: " << L[i] << "\n"; adj[H[i][0]].emplace_back(H[i][1], L[i]); adj[H[i][1]].emplace_back(H[i][0], L[i]); } dfs(0, -1); s2l(0, -1); if(ans == maxN) { ans = -1; } return ans; }

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

/usr/bin/ld: /tmp/ccWnWFg1.o: in function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status