BZOJ2815 [ZJOI2012]灾难
<div class="post_brief"><p> 灭绝树的模板题么。之前不知道这题,差点当原创题出出去了。</p> 好像有不少人不知道这东西的样子?orz zhx。 灭绝树只有一句口诀:一个东西的父亲是所有入边的另一端的点的LCA。 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; struct edge { int t; edge *next; }; const int maxn = 70009; const int maxl = 19; const int maxe = 2000009; int n, ind[maxn], oud[maxn], tpo[maxn], ath[maxn][maxl], sz[maxn], d[maxn]; edge *ha[maxn], *hr[maxn], *ht[maxn]; inline void addEdge(edge** head, int u, int v) { edge* ep = new edge; ep-> t = v; ep-> next = head[u]; head[u] = ep; }...