Submission #1020601

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10206012024-07-12 07:29:59AliHasanliTraffic (IOI10_traffic)C++17
100 / 100
923 ms186300 KiB
#include "traffic.h"
#include<bits/stdc++.h>
using namespace std;
long long val[1000005],subtree[1000005],ans=1000000000000000000,calc[1000005];
vector<int>g[1000005];
void dfs(int node,int p)
{
subtree[node]=val[node];
for(int go:g[node])
if(go!=p)dfs(go,node),subtree[node]+=subtree[go];
}
void answer(int node,int p)
{
//cout<<ans<<endl;
//long long calc=0;
for(int go:g[node])
{
if(go!=p)
{
calc[node]=max(calc[node],subtree[go]);
answer(go,node);
}
else calc[node]=max(calc[node],subtree[1]-subtree[node]);
}
ans=min(ans,calc[node]);
}
int LocateCentre(int N, int pp[], int S[], int D[]) {
for(int i=1;i<=N;i++)val[i]=pp[i-1];
//for(int i=1;i<=N;i++)cout<<val[i]<<" ";cout<<endl;
for(int i=0;i<N-1;i++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...