제출 #411420

#제출 시각아이디문제언어결과실행 시간메모리
411420alextodoranTraffic (IOI10_traffic)C++17
컴파일 에러
0 ms0 KiB
/** ____ ____ ____ ____ ____ ||a |||t |||o |||d |||o || ||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\| **/ #include <bits/stdc++.h> #include "traffic.h" using namespace std; typedef long long ll; const int N_MAX = 100000; int n; int p[N_MAX]; int subSize[N_MAX]; vector <int> edges[N_MAX]; int parent[N_MAX]; void dfs (int u) { subSize[u] = p[u]; for(int v : edges[u]) if(v != parent[u]) { parent[v] = u; dfs(v); subSize[u] += subSize[v]; } } int LocateCenter (int N, int* P, int* X, int* Y) { n = N; for(int u = 0; u < n; u++) p[u] = P[u]; for(int i = 0; i < n - 1; i++) { edges[X[i]].push_back(Y[i]); edges[Y[i]].push_back(X[i]); } parent[0] = -1; dfs(0); int best = INT_MAX; int answer = -1; for(int u = 0; u < n; u++) { int maxFlow = subSize[0] - subSize[u]; for(int v : edges[u]) if(v != parent[u]) maxFlow = max(maxFlow, subSize[v]); if(maxFlow < best) { best = maxFlow; answer = u; } } return answer; }

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

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