#include using namespace std; typedef long long LL; #define fin "\n" #define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define fi first #define se second #define pb push_back #define DEBUG if(0) #define REC(ret, ...) std::function template inline bool chmin(T &l,T r) {bool a=l>r;if(a)l=r;return a;} template inline bool chmax(T &l,T r) {bool a=l istream& operator>>(istream &is,vector &v){ for(auto &it:v)is>>it; return is; } typedef vector V; typedef vector VV; int N,M,Q; int A[212345]; int B[212345]; int imos[112345]; V g[112345]; int X[112345]; VV Y,gg; void dfs1(int v,int p,int d){ X[v]=d; for(auto &e:g[v]){ int u=A[e]^B[e]^v; if(u==p)continue; if(X[u]=0)continue; if(imos[u]==0){ int nk=gg.size(); gg.pb({}); gg[k].pb(nk); dfs2(u,nk); } else{ dfs2(u,k); } } } void input(){ scanf("%d%d%d",&N,&M,&Q); REP(i,M){ scanf("%d%d",A+i,B+i); g[--A[i]].pb(i); g[--B[i]].pb(i); } } //heavy light decomposition namespace hld{ #define SZ 200010 int mem[4][SZ]; }; typedef vector Graph; class HLD{ private: int *treesize; Graph *tree; public: int size,*group,*id,*par,*bg; private: void setTreeSize(int v){ treesize[v]=1; for(auto &u:(*tree)[v]){ setTreeSize(u); treesize[v]+=treesize[u]; } } void build(int v,int g,int& i){ group[v]=g; id[v]=i++; Graph &gr=(*tree); const int sz=gr[v].size(); if(sz){ int h=gr[v][0]; for(auto &u:gr[v]) if(treesize[h]; int lca(int v,int u){ while(group[v]!=group[u]){ if(group[v] decomposition(int v,int u){ vector

res; while(group[v]!=group[u]){ if(group[v] W[512345]; typedef int ID; struct node{ ID id; }; #define isB (1<<0) #define isC (1<<1) ID mg(node& v,int l,int r){ return v.id; } ID mg(ID l,ID r){ if(W[l].top()>=W[r].top())return l; else return r; } namespace ST{ node mem[1][512345]; int cnt=0; node* get(){return mem[cnt++];} } struct seg_tree{ int size; node *seg; void init(int l,int r,int k=0){ auto &v=seg[k]; if(r-l==1){ //葉の時の処理 v.id=l; W[l].push(-1); } else if(r-l>1){ int m=(l+r)/2; init(l,m,k*2+1);init(m,r,k*2+2); v.id=mg(mg(seg[k*2+1],l,m),mg(seg[k*2+2],m,r)); } } seg_tree(int n){ size=1; while(size