Skip to content

Instantly share code, notes, and snippets.

#include <cstdio>
#include <algorithm>
const int N = 200009;
int col[N],c[N * 2],In[N],Ou[N],f[N][20],tot[N],d[N],top[N],Max[N],rt[N],sz[N],n,n2,m,lc[N * 2],rc[N * 2],add[N * 2][2],cnt,t[N];
int L,R,V,son[N],lnk[N * 2],nxt[N * 2],ec;
inline void addedge(const int x,const int y)
{
nxt[++ec] = son[x];
son[x] = ec;
lnk[ec] = y;
#include <cstdio>
#include <algorithm>
#include <set>
using std::multiset;
const int N = 100000 + 9;
int col[N],n,son[N],lnk[N * 2],nxt[N * 2],fa[N],ec;
struct info
{
int l[N],r[N],p[N],max[N],v[N];
multiset<int>s[N];
#include <cstdio>
const int N = 100009;
int ec,son[N],lnk[N * 2],nxt[N * 2],col[N],fa[N];
struct lct
{
int l[N],r[N],p[N],sz[N],w[N];
void init(int n)
{
++n;
for (int i = 0; i <= n; ++i) l[i] = r[i] = p[i] = sz[i] = 0;