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

#TimeUsernameProblemLanguageResultExecution timeMemory
400312Pichon5Traffic (IOI10_traffic)C++17
100 / 100
1168 ms186444 KiB
#include<bits/stdc++.h> #include "traffic.h" #define pb push_back #define vi vector<int> #define ll long long using namespace std; const int tam=1e6; vector<int> G[tam]; ll peso[tam]; ll tot[tam];//suma de todos sus hijos ll dp[tam];//maximo de sus hijos ll sum=0; int ind=0; ll mi=1e18; void dfs(ll nodo, int p){ for(int i=0;i<G[nodo].size();i++){ int it=G[nodo][i]; if(it==p)continue; dfs(it,nodo); tot[nodo]+=tot[it]; dp[nodo]=max(dp[nodo],tot[it]); } ll aux=max(dp[nodo],sum-tot[nodo]); if(aux<mi){ ind=nodo; mi=aux; } } int LocateCentre(int N, int pp[], int S[], int D[]) { for(int i=0;i<N;i++){ peso[i]=pp[i];sum+=pp[i];tot[i]=peso[i]; } for(int i=0;i<N-1;i++){ int a=S[i],b=D[i]; G[a].pb(b);G[b].pb(a); } dfs(0,-1); return ind; }

Compilation message (stderr)

traffic.cpp: In function 'void dfs(long long int, int)':
traffic.cpp:16:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=0;i<G[nodo].size();i++){
      |                 ~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...