Submission #298553

#TimeUsernameProblemLanguageResultExecution timeMemory
298553aloo123Traffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <ratio> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #include <climits> // #include "traffic.h" #define ll long long #define ld long double #define mp make_pair #define pb push_back #define in insert #define vll vector<ll> #define endl "\n" #define pll pair<ll,ll> #define f first #define s second #define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++) #define int ll #define sz(x) (ll)x.size() #define all(x) (x.begin(),x.end()) using namespace std; const ll INF = 1e12; const ll N =(1e6+5); // TODO : change value as per problem const ll MOD = 1e9+7; vector<int> adj[N]; int sub[N]; int a[N]; void dfs(int u,int p){ sub[u] = a[u]; for(auto v:adj[u]){ if(v != p){ dfs(v,u); sub[u] += sub[v]; } } } int LocateCentre(int n,int p[],int s[],int d[]){ for(int i = 0;i<n;i++){ a[i+1] = p[i]; } for(int i =0;i<n-1;i++){ int u = s[i],v = d[i]; u++; v++; adj[u].pb(v); adj[v].pb(u); } int ans = INF,x = -1; for(int i = 1;i <= n;i++){ dfs(i,0); int ma = 0; for(auto v:adj[i]){ ma = max(ma,sub[v]); } if(ma < ans){ ans = ma; x = i; } } x--; return x; } // void solve(){ // } // signed main(){ // ios_base::sync_with_stdio(0); // cin.tie(NULL); // // freopen(".in","r",stdin);freopen(".out","w",stdout); // int n; // cin >> n; // int p[n]; // for(int i =0;i<n;i++){ // cin >> p[i]; // } // int s[n-1]; // int d[n-1]; // for(int i =0;i<n-1;i++){ // cin >> s[i] >> d[i]; // } // cout << LocateCentre(n,p,s,d) << endl; // }

Compilation message (stderr)

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