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

#TimeUsernameProblemLanguageResultExecution timeMemory
383081DarkVoidTraffic (IOI10_traffic)C++11
100 / 100
1298 ms225772 KiB
#pragma GCC optimize("unroll-loops, O3") #pragma GCC target("avx") #include <bits/stdc++.h> using namespace std; int n, a[1000000], cnt[1000000], mx[1000000]; vector<int> adj[1000000]; void dfs(int vtx, int pre, vector<vector<int>> &adj, vector<int> &cnt, vector<int> &mx, int a[]){ mx[vtx] = 0, cnt[vtx] = a[vtx]; for(int i : adj[vtx]) if(i != pre){ dfs(i, vtx, adj, cnt, mx, a); cnt[vtx] += cnt[i]; mx[vtx] = max(mx[vtx], cnt[i]); } } int LocateCentre(int n, int a[], int s[], int d[]){ ios_base::sync_with_stdio(false); cin.tie(NULL); vector<vector<int>> adj(n); vector<int> cnt(n), mx(n); 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, adj, cnt, mx, a); pair<int, int> ans(INT_MAX, -1); for(int i = 0; i < n; i++) ans = min(ans, make_pair(max(cnt[0] - cnt[i], mx[i]), i)); return ans.second; }

Compilation message (stderr)

traffic.cpp:1:40: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
    1 | #pragma GCC optimize("unroll-loops, O3")
      |                                        ^
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
    2 | #pragma GCC target("avx")
      |                         ^
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
traffic.cpp:2:25: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
/var
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...