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

#TimeUsernameProblemLanguageResultExecution timeMemory
503220_AnKahngTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define fo(i,a,b) for(int i=a;i<=b;i++) using namespace std; const int M = 1e6+5; int n,p[M],id; long long sum,f[M],res=LLONG_MAX; vector<int> dsk[M]; void dfs(int u, int par){ long long mx = -1, o = p[u]; for(auto v : dsk[u]) if(v != par){ dfs(v,u); mx = max(mx,f[v]); o += f[v]; } f[u] = o; mx = max(mx,sum - o); if(res > mx) res = mx, id = u; } int main() { cin >> n; fo(i,1,n) cin >> p[i], sum = 0LL + sum + p[i]; fo(i,1,n-1){ int x,y; cin >> x >> y; x ++; y ++; dsk[x].push_back(y); dsk[y].push_back(x); } dfs(1,1); cout << id - 1; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccbONRFl.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cceHOnSh.o:traffic.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccbONRFl.o: in function `main':
grader.cpp:(.text.startup+0xe1): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status