Submission #241614

#TimeUsernameProblemLanguageResultExecution timeMemory
241614lakshith_Traffic (IOI10_traffic)C++14
50 / 100
29 ms2688 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 LocateCentre(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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...