The Famous ICPC Team Again Problem Description   When Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-ICPC World Final Contest, Mr. B had collected a large set of contest problems for their daily training. When they decided to take training, M…
The Famous ICPC Team Again Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1440    Accepted Submission(s): 708 Problem Description When Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-I…
The Famous ICPC Team Again Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1091    Accepted Submission(s): 530 Problem Description When Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-I…
划分树水题..... The Famous ICPC Team Again Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 859    Accepted Submission(s): 415 Problem Description When Mr. B, Mr. G and Mr. M were preparing for the…
划分树模板题目,主席树也可解.划分树. /* 4251 */ #include <iostream> #include <sstream> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <deque> #include <a…
Problem Description Mr. B, Mr. G, Mr. M and their coach Professor S are planning their way to Warsaw for the ACM-ICPC World Finals. Each of the four has a square-shaped suitcase with side length Ai (1<=i<=4) respectively. They want to pack their sui…
题意: 给出一棵树,每条边有一个容量. 有若干次询问:\(S \, T \, K \, A \, B\),求路径\(S \to T\)的最大流量. 有两种方法可以增大流量: 花费\(A\)可以新修一条管道,管道可以连接任意两个点,两个点之间可以有任意条管道连接,新修的管道容量为\(1\) 花费\(B\)可以使某条管道(包括新修的管道)的容量增加\(1\) 求在不超过预算\(K\)的情况下的最大流量. 分析: 注意到流量最大只有\(10^4\),所以我们可以直接在值域上建一棵主席树. 主席树区间维…
Keen On Everything But Triangle 感觉最近多校好多主席树的亚子,但是本人菜得很,还没学过主席树,看着队友写题就只能划水,\(WA\)了还不能帮忙\(debug\),所以深思熟虑之后决定学习一下主席树. 题意 问在\([l,r]\)区间内取三个数字构成三角形,问能构成的三角形最大的周长是多少?如果不能构成三角形输出\("-1"\). 思路 三角形构成的条件: 三条边 两边之和大于第三边 然后呢,我们要找最大的周长,那么我们很容易想到取最大的三条边,如果不行就…
传送门 •题意 有 $m$ 次询问,每次询问求 $n$ 个数中, $[L,R]$ 区间距 $p$ 第 $k$ 近的数与 $p$ 差值的绝对值: •题解 二分答案,假设当前二分的答案为 $x$,那么如何判断 $x$ 是否可以呢? 只需判断 $[L,R]$ 区间值在 $[p-x,p+x]$ 的数的个数 $sum$ 是否大于等于 k 即可: 如果 $sum \geq k$,那么,x 大了,需要减小范围,反之,需要增大范围: 如何快速求解 $[L,R]$ 区间值在 $[p-x,p+x]$ 的数的个数呢?…
Problem Description When Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-ICPC World Final Contest, Mr. B had collected a large set of contest problems for their daily training. When they decided to take training, Mr. B would choose one of them…