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

#TimeUsernameProblemLanguageResultExecution timeMemory
441671mateTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define int long long #define ull unsigned ll #define pii pair<int,int> #define pll pair<ll,ll> #define ff first #define ss second #define pb push_back #define INF LLONG_MAX using namespace std; const int NMAX=200001; int p[NMAX],d[NMAX]; vector<int> g[NMAX]; void DFS(int v,int e=-1){ d[v]=p[v]; for(int u: g[v]) if(u!=e){ DFS(u,v); d[v]+=d[u]; } } int mn=INF; void dfs(int v,int e=-1){ int ans=d[1]-d[v]; for(int u: g[v]) if(u!=e){ dfs(u,v); ans=max(ans,d[u]); } mn=min(mn,ans); } main(){ int n; cin >> n; for(int i=1;i<=n;i++) cin >> p[i]; for(int i=1;i<n;i++){ int v,u; cin >> v >> u; g[v].pb(u); g[u].pb(v); } DFS(1); dfs(1); cout << mn; }

Compilation message (stderr)

traffic.cpp:35:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   35 | main(){
      | ^~~~
/usr/bin/ld: /tmp/cct7zO6k.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cccvKBnm.o:traffic.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cct7zO6k.o: in function `main':
grader.cpp:(.text.startup+0xe1): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status