#include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> #include<cstring> #define ll long long using namespace std; ][]; void RMQ_init(int l, int r) { int i, j; ]); ; l + ( << j)…
LCA模板题 随便找的倍增模板... #include<bits/stdc++.h> using namespace std; const int maxn = 1e5+11; int to[maxn<<2],nxt[maxn<<2],cost[maxn<<2]; int head[maxn],tot; int fa[maxn][20],dep[maxn]; void init(){ memset(head,-1,sizeof head); memset(f…
先上我原来的错误的代码 type node=^link; link=record num:int64; next:node; end; var fa:..,..] of int64; dep:..] of int64; nd:..] of node; b:..] of boolean; dl:..] of int64; n,m,maxdep,ans,t1,t2:int64; i:longint; procedure maketree; var t1,t2,head,tail:int64; i,j…