Submission #683129

#TimeUsernameProblemLanguageResultExecution timeMemory
683129mseebacherTraffic (IOI10_traffic)C++17
0 / 100
3 ms2672 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; #define MAXI (int)1e5 #define pb(x) push_back(x) vector<int> ad[MAXI]; vector<bool> vis(MAXI,0); void dfs(int x){ if(vis[x]) return; vis[x] = 1; for(auto s:ad[x]){ dfs(s); } } int LocateCentre(int n,int p[],int s[],int d[]){ ll left = 0; ll right = 0; ll maxi = 1e18; for(int i = 1;i<n;i++){ right += p[i]; } int node = 0; for(int i = 1;i<n;i++){ left += p[i-1]; right -= p[i]; if(maxi > max(right,left)){ maxi = max(right,left); node = i; } } return node; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...