LCA
ThreeWater-
这个作者很懒,什么都没留下…
展开
-
LCA离线 hiho1067
dfs(u)//marge和find为并查集合并函数和查找函数 { for each(u,v) //访问所有u子节点v { dfs(v); //继续往下遍历 marge(u,v); //合并v到u上 标记v被访问过; } for each(u,e) //访问所有和u有询问关系的e原创 2017-03-09 19:05:33 · 206 阅读 · 0 评论 -
hdu2586 lca
lca裸题#include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <queue> #include <map> #include <cmath> #include <iostream> #define INF 0x3f3f3f3f using namespace std; const i原创 2017-03-09 21:06:42 · 188 阅读 · 0 评论 -
hdu2586 lca+rmq
#include<bits/stdc++.h> using namespace std; const int N=40010; const int M=20; int s; struct node { int v,w; node() {} node(int vv,int ww) { v=vv; w=ww; } }; vector原创 2017-07-19 11:56:34 · 239 阅读 · 0 评论