제출 #848550

#제출 시각아이디문제언어결과실행 시간메모리
848550toma_ariciuTraffic (IOI10_traffic)C++17
컴파일 에러
0 ms0 KiB
#include <vector> using namespace std; #define int long long const int maxN = 1000005; int sz[maxN], bestDiff, bestCity, total; vector <int> G[maxN]; void dfs(int nod, int tata) { int currDiff = 0; for (int vecin : G[nod]) { if (vecin == tata) { continue; } dfs(vecin, nod); sz[nod] += sz[vecin]; currDiff = max(currDiff, sz[vecin]); } currDiff = max(currDiff, total - sz[nod]); if (currDiff < bestDiff) { bestDiff = currDiff; bestCity = nod; } } int LocateCentre(int N, int P[], int S[], int D[]) { for (int i = 0; i < N; i++) { sz[i] += P[i]; total += P[i]; } bestDiff = 2e9 + 5; for (int i = 0; i < N - 1; i++) { G[S[i]].push_back(D[i]); G[D[i]].push_back(S[i]); } dfs(0, 0); return bestCity; }

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

/usr/bin/ld: /tmp/cctIbQOl.o: in function `main':
grader.cpp:(.text.startup+0xe1): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status