# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
546212 | Deepesson | Power Plant (JOI20_power) | C++17 | 885 ms | 28324 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define MAX 205000
std::vector<int> con[MAX];
bool existe[MAX];
int dfs(int pos,int prev){
int size=1;
for(auto&x:con[pos]){
if(x==prev||existe[x])continue;
size+=dfs(x,pos);
}
return size;
}
int centroide;
int find_centroide(int pos,int prev,int sz){
int size=1;
int max=0;
for(auto&x:con[pos]){
if(x==prev||existe[x])continue;
int b =find_centroide(x,pos,sz);
size+=b;
max=std::max(max,b);
}
max=std::max(max,sz-size);
if(max<=sz/2)centroide=pos;
return size;
}
std::string valores;
int explora(int pos,int prev){
int ans=0;
if(valores[pos]=='1')ans=1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |