# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383073 | DarkVoid | Traffic (IOI10_traffic) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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){
mx[vtx] = 0, cnt[vtx] = a[vtx];
for(int i : adj[vtx])
if(i != pre){
dfs(i, vtx);
cnt[vtx] += cnt[i];
mx[vtx] = max(mx[vtx], cnt[i]);
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i = 0; i < n; i++) cin >> a[i];
for(int i = 1; i < n; i++){
int u, v;
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
dfs(0, -1);
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));
cout << ans.second << '\n';
return 0;
}
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