看到题目,想了挺长时间,发现不会,然后看着样子像是树上成段操作,所以查了下树链刨分,结果真的就是这个东西... Minimum Cut Time Limit: 3000/2000 MS (Java/Others) Memory Limit: 65535/102400 K (Java/Others)Total Submission(s): 453 Accepted Submission(s): 180 Problem Description Given a simple unweigh…
2013-11-19 16:21 原题传送门http://www.lydsy.com/JudgeOnline/problem.php?id=2243 树链剖分,用线段树记录该区间的颜色段数,左右端点颜色数,然后就OK了 //By BLADEVIL type rec =record sum, left, right, succ, pred :longint; lazy :longint; end; var n :longint; pre, other :..] of longint; last :…
/*H E A D*/ int from[maxn<<1],to[maxn<<1],nxt[maxn<<1],cost[maxn<<1],head[maxn],tot; int size[maxn],fa[maxn],depth[maxn],top[maxn],son[maxn],dfn[maxn],pre[maxn],tot2; void init(){ memset(head,-1,sizeof head); memset(son,0,sizeof so…
思路: http://blog.csdn.net/lych_cys/article/details/50763073 lych的题解-- 写得很详细 //By SiriusRen #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define int long long #define N 300050 int n,Q,A,age[N],w[N],v[N],ne…
Stability Time Limit: 3000/2000 MS (Java/Others) Memory Limit: 65535/102400 K (Java/Others)Total Submission(s): 1347 Accepted Submission(s): 319 Problem Description Given an undirected connected graph G with n nodes and m edges, with possibly r…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4897 Problem Description There is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although the king used to be wise and beloved by his peopl…
FZU 2082 过路费 题目链接 树链抛分改动边的模板题 代码: #include <cstdio> #include <cstring> #include <vector> using namespace std; typedef long long ll; const int N = 50005; int dep[N], id[N], sz[N], top[N], son[N], fa[N], idx; int n, m; ll bit[N]; struct Ed…