제출 #445498

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4454982021-07-18 10:26:03ivan_tudorMergers (JOI19_mergers)C++14
100 / 100
1029 ms137448 KiB
#include<bits/stdc++.h>
using namespace std;
const int N = 500005;
vector<int> gr[N];
int par[20][N];
int in[N], out[N];
int sum[N];
int frv[N];
int tp[N];
void dfs_prec(int nod, int dad,int &cur){
par[0][nod] = dad;
in[nod] = ++cur;
for(auto x:gr[nod]){
if(x != dad){
dfs_prec(x, nod, cur);
}
}
out[nod] = cur;
}
void prec_lca(int n){
for(int log = 1; log < 20; log ++){
for(int nod = 1; nod <=n; nod++)
par[log][nod] = par[log -1][par[log - 1][nod]];
}
}
bool is_dad(int nod, int son){
if(in[nod]<= in[son] && out[son] <= out[nod])
return true;
return false;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...
#Verdict Execution timeMemoryGrader output
Fetching results...