Submission #1059127

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10591272024-08-14 17:34:30jamjanekCity (JOI17_city)C++14
8 / 100
202 ms54476 KiB
#include "Encoder.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>graf[250010];
int preorder[250010], post[250010], preit, postit;
int r[250010];
vector<int>rozmiary;
void dfs(int x, int o){
preorder[x]=preit++;
for(auto j: graf[x])
if(j!=o){
dfs(j, x);
r[x]+=r[j]+1;
}
int pom = *lower_bound(rozmiary.begin(), rozmiary.end(), r[x]);
preit+=pom-r[x];
r[x]+=pom-r[x];
}
void Encode(int n, int A[], int B[])
{
rozmiary.push_back(0);
while(rozmiary.size()<=30){
rozmiary.push_back(max(rozmiary.back()+1, int(2*rozmiary.back())));
}
int i;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...