随笔分类 - acm / 倍增
摘要:D - Program st表 / 线段树 若查询去掉 操作后,整个操作过程中出现的值有哪些,由于每次操作值都是 +1 或 -1,因此是连续的,只要求出整个操作过程中出现的最大值和最小值即可 求出前缀和, 因为 l 可能为 1,r 可能为 n,所以令 \(s[0]=0,\;s[n
阅读全文
摘要:理想的正方形 二维倍增 SCUACM2022集训前训练-动态规划 - Virtual Judge (vjudge.net) 设 为以 为左上角,边长为 的正方形内元素的最大值 #include <iostream> #inclu
阅读全文
摘要:LCA 倍增 #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <queue> using namespace std; typedef long long ll; const
阅读全文
摘要:E - Gold Transfer 树上倍增 + 贪心 由于 , 所以一定是把结点祖先的黄金采完才会采这个结点的,因此某个点有无黄金这个性质具有单调性,靠近根的一侧没有,靠近叶子的有,所以可以倍增查到某个结点上方离根最近的有黄金的结点,从该点开始采 由于一个点被采完才会
阅读全文