제출 #1000625

#제출 시각아이디문제언어결과실행 시간메모리
1000625nmts경주 (Race) (IOI11_race)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "race.h" using namespace std; struct Highway { int to; int length; }; void dfs(int node, int parent, int K, int currentLength, int currentHighways, vector<vector<Highway>>& graph, int& minHighways) { if (currentLength > K) { return; } if (currentLength == K) { minHighways = min(minHighways, currentHighways); return; } for (const Highway& highway : graph[node]) { if (highway.to != parent) { dfs(highway.to, node, K, currentLength + highway.length, currentHighways + 1, graph, minHighways); } } } int best_path(int N, int K, vector<vector<int>>& H, vector<int>& L) { vector<vector<Highway>> graph(N); for (int i = 0; i < N - 1; ++i) { graph[H[i][0]].push_back({H[i][1], L[i]}); graph[H[i][1]].push_back({H[i][0], L[i]}); } int minHighways = INT_MAX; for (int i = 0; i < N; ++i) { dfs(i, -1, K, 0, 0, graph, minHighways); } return (minHighways == INT_MAX) ? -1 : minHighways; }

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

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