BZOJ1488 || POJ1741 Tree
据说是男人八题。 状态太差调了一节宝贵的晚自习,严重不开心。 异常裸的点分治。然后里面还是套的sbt。 卡空间比较丧病,不能开nlogn,要想办法开到n。其实就是找重心分治完再bfs一遍。最初没有写,所以mle爽,在poj上还显示的是re。 然后各种逗的错误调啊调。把代码调得怪丑。我还是naive啊。 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; struct edge { int t, v; edge *next; }; const int maxn = 40009; int n, k, ans; int d[maxn], tvis, vis[maxn], vd[maxn], sz[maxn], qu[maxn]; edge *ep, *head[maxn], elst[maxn * 2]; #define update(_p_) (sz[_p_]=sz[ls[_p_]]+sz[rs[_p_]]+1) namespace sbt { const int maxnd = maxn * 2; const int balc = 5; int nst[maxnd], tn; int ls[maxnd], rs[maxnd], vl[maxnd], sz[maxnd]; inline void lRot(int& p) {...