(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #282364

#TimeUsernameProblemLanguageResultExecution timeMemory
282364iliccmarkoTraffic (IOI10_traffic)C++14
100 / 100
1302 ms160588 KiB
#include <bits/stdc++.h> #include<traffic.h> using namespace std; #define ll long long #define endl "\n" using namespace std; int ans = INT_MAX; int ind; int svi; vector<vector<int> > g(1000005); int dfs(int u, int pret, int *p) { int br = 0; int maks = 0; for(int i = 0;i<(int)g[u].size();i++) { int s = g[u][i]; if(s==pret) continue; int k = dfs(s, u, p); br+=k; maks = max(maks, k); } maks = max(maks, svi - p[u] - br); if(maks<ans) { ans = maks; ind = u; } return br + p[u]; } int LocateCentre(int n, int *p, int *s, int *d) { for(int i = 0;i<n-1;i++) { int a = s[i]; int b = d[i]; g[a].push_back(b); g[b].push_back(a); } for(int i = 0;i<n;i++) { svi+=p[i]; } dfs(0, -1, p); return ind; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...