Submission #241612

#TimeUsernameProblemLanguageResultExecution timeMemory
241612lakshith_Traffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "traffic.h" #define pb push_back using namespace std; vector<vector<int>> adjList(1000,vector<int>()); int DFS(int n,int s,int* p){ int sum = p[n]; for(int x:adjList.at(n)) if(x!=s)sum += DFS(x,n,p); return sum; } int LocateCenter(int n,int p[],int s[],int d[]){ for(int i=0;i<n-1;i++){ adjList.at(s[i]).pb(d[i]); adjList.at(d[i]).pb(s[i]); } int MIN = INT_MAX; int minPos = 0; for(int i=0;i<n;i++){ int MAX = 0; for(int x:adjList.at(i)) MAX = max(MAX,DFS(x,i,p)); if(MAX < MIN){ MIN = MAX; minPos = i; } } return minPos; }

Compilation message (stderr)

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