(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 #403161

#TimeUsernameProblemLanguageResultExecution timeMemory
403161NafeeszxTraffic (IOI10_traffic)C++17
100 / 100
1114 ms143300 KiB
#include <bits/stdc++.h> using namespace std; #define trav(a, x) for(auto& a : x) const int MX = 1e6; vector<int> adj[MX]; vector<int> nodes(MX); vector<int> children(MX); vector<int> people(MX, 0); int citizen = 0; void dfs(int u, int p){ trav(v, adj[u]){ if(v != p){ dfs(v, u); children[u] += children[v]; people[u] = max(people[u], children[v]); } } people[u] = max(people[u], citizen - children[u] - nodes[u]); children[u] += nodes[u]; } int LocateCentre(int n, int p[], int s[], int d[]){ for(int i = 0; i < n; ++i){ nodes[i] = p[i]; citizen += p[i]; } for(int i = 0; i < n - 1; ++i){ adj[s[i]].push_back(d[i]); adj[d[i]].push_back(s[i]); } dfs(0, -1); int minpeople = 2e9 + 1, res = 0; for(int i = 0; i < n; ++i){ if(people[i] < minpeople){ res = i; minpeople = people[i]; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...