제출 #532227

#제출 시각아이디문제언어결과실행 시간메모리
532227srivatsav_kannanTraffic (IOI10_traffic)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include "traffic.h" #include <fstream> #include <vector> #include <set> #include <queue> #include <cmath> #include <map> #include <algorithm> #include <numeric> #include <stack> #include <cstring> #include <bitset> #include <climits> #include <valarray> #include <list> #define INF 1000000000 #define endl '\n' #define int long long #define mod 1000000007 using namespace std; vector<int> adj[1000]; int vis[1000], ar[1000]; int dfs(int node, bool root = true){ int mx = 0; if (!root) mx = ar[node]; vis[node] = 1; for (int child:adj[node]){ if (vis[child] == 0){ int cur = dfs(child, false); if (root) mx = max(mx, cur); else mx += cur; } } return mx; } int LocateCentre(int n, int p[], int s[], int d[]){ for (int i = 0; i < n-1; i++){ adj[s[i]].push_back(d[i]); adj[d[i]].push_back(s[i]); } for (int i = 0; i < n; i++) ar[i] = p[i]; int mn = 1e17, mni = -1; for (int i = 0; i < n; i++){ memset(vis, 0, sizeof vis); int cur = dfs(i); if (cur < mn){ mn = cur; mni = i; } } return mni; }

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

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