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

#TimeUsernameProblemLanguageResultExecution timeMemory
377140kevinxiehkTraffic (IOI10_traffic)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb emplace_back #define fi first #define se second #define ick cout<<"ickbmi32.9\n" using namespace std; int ans=0,arr[1000005],wt[1000005],n,t,tt; vector<int>conn[1000005]; void dfs1(int now){ wt[now]=arr[now]; for(auto x:conn[now]){ if(wt[x]!=-1)continue; dfs1(x); wt[now]+=wt[x]; } return; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); cin>>n; for(int i=0;i<n;i++)cin>>arr[i]; for(int i=1;i<n;i++){ cin>>t>>tt; conn[t].pb(tt);conn[tt].pb(t); } memset(wt,-1,sizeof wt); dfs1(0); while(1){ //for(int i=0;i<n;i++)cout<<wt[i]<<' '; //cout<<ans<<'\n'; int tm=-1,tmid=-1; for(auto x:conn[ans]){ if(wt[x]>tm){ tm=wt[x]; tmid=x; } } if(wt[ans]-wt[tmid]>=tm){ cout<<ans<<'\n'; return 0; } wt[tmid]=wt[ans]; wt[ans]=-1; ans=tmid; } return 0; }

Compilation message (stderr)

/tmp/ccWKIvH0.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cczvYe1H.o:traffic.cpp:(.text.startup+0x0): first defined here
/tmp/ccWKIvH0.o: In function `main':
grader.cpp:(.text.startup+0xd9): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status