제출 #314847

#제출 시각아이디문제언어결과실행 시간메모리
314847LethalPuppyTraffic (IOI10_traffic)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "traffic.h" using namespace std; const int N = 1e6+5; vector<int> neighbours[N]; int fans[N], total = 0, res = 0, traffic[N], posans[N], nums = 2e9+1; void dfs(int u, int v) { for (auto &x: neighbours[u]) { if (x == v) continue; dfs(x, u); traffic[u] += traffic[x]; posans[u] = max(posans[u], traffic[x]); } posans[u] = max(posans[u], total - traffic[u] - fans[u]); traffic[u] += fans[u]; } int LocateCenter(int n, int p[], int s[], int d[]) { for (int i = 0; i < n - 1; ++i) { neighbours[s[i]].push_back(d[i]), neighbours[d[i]].push_back(s[i]); fans[i] = p[i], total += p[i]; } fans[n - 1] = p[n - 1], total += p[n - 1]; dfs(0, -1); for (int i = 0; i < n; ++i) { if (nums > posans[i]) { nums = posans[i]; res = i; } } return res; }

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

/tmp/ccJpfz6a.o: In function `main':
grader.cpp:(.text.startup+0xad): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status