제출 #450864

#제출 시각아이디문제언어결과실행 시간메모리
450864joshjmsTraffic (IOI10_traffic)C++14
컴파일 에러
0 ms0 KiB
#include "traffic.h" #include <bits/stdc++.h> #define KON using #define AQUA namespace std; KON AQUA #define ll long long #define int long long #define pb push_back #define fi first #define se second #define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define debug(x) cout << #x << " => " << x << "\n"; #define sp " " #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") const int inf = 0x3f3f3f3f; const int INFF = 1e18 + 5; const int INF = 1e10 + 5; const int MX = 3e5 + 5; const int MXL = 105; const int mod = 1e9 + 7; const double ERROR = 1e-5; int arr[MX], max_cong[MX], total; pair <int,int> ans = {INFF, INFF}; vector <int> E[MX]; bool vis[MX]; int dfs(int pos){ int sum = arr[pos], res = 0; for(auto i:E[pos]){ if(vis[i]) continue; vis[i] = 1; int ret = dfs(i); res = max(res, ret); sum += ret; } res = max(res, total - sum); max_cong[pos] = res; return sum; } int LocateCentre(int N, int pp[], int S[], int D[]) { for(int i = 0; i < N; i++){ arr[i] = pp[i]; total += arr[i]; } for(int i = 0; i < N - 1; i++){ E[S[i]].pb(D[i]); E[D[i]].pb(S[i]); } vis[0] = 1; dfs(0); for(int i = 0; i < N; i++) ans = min(ans, {max_cong[i], i}); return ans.se; } /* static int N,P[1000000],S[1000000],D[1000000]; int32_t main(){ int i; scanf("%d",&N); for (i=0;i<N;i++) scanf("%d",&P[i]); for (i=0;i<N-1;i++) scanf("%d%d",&S[i],&D[i]); int r = LocateCentre(N,P,S,D); printf("%d\n",r); return 0; } */

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

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