05 2023 档案
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc258_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc258/tasks/abc258_h "AtCoder 传送门") 不错的矩阵快速幂优
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc153_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc153/tasks/arc153_d "AtCoder 传送门") 又浪费一道好题 [AtCoder 传送门](https://atcoder.jp/contests/arc148/tasks/arc148_e "AtCoder 传送门") 是一道不错的计数。
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1830D "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1830/problem/D "CF 传送门") 考虑答案的下界。 对整棵树进行二分图染色,我们得到答案
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1830C "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1830/problem/C "CF 传送门") 每一步思路都非常自然的题。 考虑先从一些简单的 cas
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc161_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc161/tasks/arc161_e "AtCoder 传送门") 给构造题提供了一种
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc303_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc303/tasks/abc303_g "AtCoder 传送门") 经典题,考虑区间
阅读全文
摘要:洛谷传送门 AtCoder 传送门 好题。 这种题一般可以考虑,观察最优解的性质,对于性质计数。 发现如果 均为偶数,可以放满。就是类似这样: #.#.#. .#.#.# #.#.#. .#.#.# 因此答案就是 。 如果 有一个为偶数,不妨假设
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1837F "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1837/F "CF 传送门") 这是一个常规 做法。 最大值最
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc146_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc146/tasks/arc146_d "AtCoder 传送门") 考虑直接增量构造。
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc193_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc193/tasks/abc193_f "AtCoder 传送门") 复习一下最小割。
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc146_c "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc146/tasks/arc146_c "AtCoder 传送门") 好可爱的题啊。 没
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc267_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc267/tasks/abc267_h "AtCoder 传送门") 直接暴力跑背包的复
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc139_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc139/tasks/arc139_d "AtCoder 传送门") 看成方案数想了 1
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc132_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc132/tasks/arc132_e "AtCoder 传送门") 感觉挺 educa
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc132_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc132/tasks/arc132_f "AtCoder 传送门") 没见过这种在新运算
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1827E "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1827/E "CF 传送门") 比较神奇的题。 定一个非叶子 为根。 显
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1784D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1784/D "CF 传送门") 我怎么连这种 combinatorics 都不会
阅读全文
摘要:[洛谷传送门](http://https://www.luogu.com.cn/problem/AT_arc139_c "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc139/tasks/arc139_c "AtCoder 传送门") ~~
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc132_d "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc132/tasks/arc132_d "AtCoder 传送门") 提供一个 dp 思
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_agc062_b "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/agc062/tasks/agc062_b "AtCoder 传送门") 妙妙题。 像这种最
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc302_h "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc302/tasks/abc302_h "AtCoder 传送门") 考虑如果只询问一次
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc130_c "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc130/tasks/arc130_c "AtCoder 传送门") 分类讨论,但是写起
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_arc133_e "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/arc133/tasks/arc133_e "AtCoder 传送门") 其实是套路题,但是
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1832D2 "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1832/problem/D2 "CF 传送门") 首先,如果一个点变成蓝色,在下一次立刻把它变成红色
阅读全文
摘要:洛谷传送门 AtCoder 传送门 感觉挺高妙的…… 为了方便,不妨把横纵坐标都整体减 。 如果单独考虑上下移动,方案数是 。发现两个人上下总共移动 次后一定会在同一行,设这行编号为 ,那么最后带个 的系数,并且除掉
阅读全文
摘要:洛谷传送门 AtCoder 传送门 考虑每条边,因为是静态的,所以可以预处理出 表示从第 条边,往后跳 条边,跳到边的编号和目前的时间(如果不存在就当作跳到第 条边)。直接倍增处理即可。 询问就是找到从 开始的出边,能跳尽量跳
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1827D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1827/D "CF 传送门") 考虑固定一个重心,设 为重心最大子树大小
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/CF1827B2 "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1827/B2 "CF 传送门") 考虑拆贡献 ,发
阅读全文
摘要:洛谷传送门 AtCoder 传送门 搞笑题,我不会做,我更搞笑。 考虑逆序操作,即初始有一个全 序列,每次单点加 或者长为 区间加 。考虑把一个操作集合唯一对应到一个最终序列,不难发现只要限制每个区间加 的次数 即可。因为如果正序操作,加上了限制,每
阅读全文
摘要:洛谷传送门 AtCoder 传送门 基础图论。 考虑快速求出 ,那么边权要 的边仅当边权等于 时答案可能为 。求 可以建出 Kruskal 重构树,查两点 点权得出。 考虑把询问离线,把相同的 $d(
阅读全文
摘要:洛谷传送门 AtCoder 传送门 考虑分类计数,讨论“没有 DD”、“有 DD 无 o”、“有 DDo 无 S”三种情况。 没有 DD,枚举有几种大写字母出现过; 剩下两种情况,考虑设 分别表示两种情况的方案数。 可以从 填大写字母
阅读全文
摘要:洛谷传送门 AtCoder 传送门 设 为 的子树, 是否在匹配内的最大匹配数。 注意到对于一个匹配,在它深度较浅的点上才会被计入答案。 转移大概是 取 $\sum\limits_{v \in son_u} \max(f_{v,0}, f_{
阅读全文
摘要:洛谷传送门 注意到如果 足够小,可以过 。选 (这样做的好处是能交换两个相邻元素),每次把值为 的元素挪到 ,注意到我们不关心其他元素,所以翻转 的效果可以看成是交换 。于是先跳大步,再跳小步。可以过 $n \le
阅读全文
摘要:洛谷传送门 AtCoder 传送门 首先 ( 个 )对能被 整除子串数量的贡献是 。 把 分解成若干 使得 $\sum\limits_{i=1}^m \frac{x_i(x_i+1)}{
阅读全文
摘要:洛谷传送门 AtCoder 传送门 感觉我的做法比较奇葩( 容斥,总路径数减去只走点权为 的路径。设点权为 的点数为 ,点权不为 的点构成的每个连通块大小为 ,那么 $ans_k = \frac{n(n-1)}{2} - \sum \frac{s_i (s
阅读全文
摘要:[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc207_f "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc207/tasks/abc207_f "AtCoder 传送门") 简单树形 dp。
阅读全文
摘要:洛谷传送门 AtCoder 传送门 把每个点分到 的正方形内,枚举相邻正方形,计入答案。 正确性显然。 复杂度证明就是所有每个正方形内距离为
阅读全文
摘要:洛谷传送门 AtCoder 传送门 显然,选出的每两个点都要组成一条直径。 进一步发现,设直径点数为 ,如果 ,所有直径都会在中点重合,否则会在连接两个中点的边重合。简单证一下,如果有两条直径不在中点或中边重合,那么: 它们不可能不重合,要不然就不会成为直径了; 它们在除
阅读全文
摘要:## 1. 多项式乘法(卷积) [FFT](https://www.luogu.com.cn/blog/flashblog/solution-p3803 "FFT") 简单来说,选取 代入,DFT 转化成点值表达式后相乘后再 IDFT。 [NTT](http://https
阅读全文
摘要:洛谷传送门 AtCoder 传送门 不妨钦定组之间的顺序是最小值越小的组越靠前,这样可以给每个组按顺序编号。 设 为考虑了模 后 的数,目前有 个非空组的方案数。 转移就是枚举模 的数新开了 个组,设 的
阅读全文
摘要:洛谷传送门 AtCoder 传送门 It's all MAGIC 这种题目一般先考虑局面要满足什么条件能必胜,然后根据这个性质来计数。 如果把黑板上的数写成一个集合 ,那么: 为必胜态, 显然为必败态,打表发现其他单元素集合都为必胜态; 如果 $
阅读全文
摘要:洛谷传送门 AtCoder 传送门 观察可以发现: 使每支箭的距离都为 一定不劣; 每支箭坐标一定为整数; 设最左边的箭坐标为 ,那么 太小时可以把最左边的箭移到最右边, 太大时可以把最右边的箭移到最左边。计算可得 的最优取值范围为 $x \in [-\left\
阅读全文
摘要:洛谷传送门 AtCoder 传送门 考虑把所有 的位置断开,分别计算然后把方案数乘起来。接下来的讨论假设 。 考虑一个 dp,设 为 最后剩下的集合的方案数。转移显然是 $f_i \gets f_i + f
阅读全文
摘要:洛谷传送门 AtCoder 传送门 首先将度数 。 设 为体积为 至多能用几个物品凑出来, 为至少。 我们现在要证明一个东西:, 合法。 首先若 合法,那么必须满足 $s - x \in [-
阅读全文
摘要:洛谷传送门 AtCoder 传送门 很厉害的题! 考虑所有车站已确定,如何求 到 的最短路。设 为只考虑 的点,到 和它左边第一个 的最短路, 同理。有转移: 若 $s_{i-1} = \t
阅读全文
摘要:洛谷传送门 AtCoder 传送门 对每个红格的行和列连边,建出二分图。对于二分图中的每个连通块分别考虑。 大胆猜测对于每个连通块,我们都能够进行适当的操作,使得只有一行/一列没被操作(显然不能使所有行和列都被操作)。对应的方案就是随便取一棵生成树,把不被染白的那一行/列拎出来当根,然后自底向上,每
阅读全文
摘要:洛谷传送门 AtCoder 传送门 很神奇但是经典的构造,学习一下。 注意到题目给的操作很像斐波那契。但是难点是如何将 个斐波那契数相加。 考虑一个操作序列 (共 个)。发现在第 个操作之前给 或 加 ,等价于最
阅读全文
摘要:洛谷传送门 AtCoder 传送门 从高到低按位考虑。 设当前位有 个 。 如果 ,这意味着 Alice 如果选了一个数,Bob 可以选相同的数。发现可以分成 两组,递归下去即可。 如果 ,意味着答
阅读全文
摘要:洛谷传送门 AtCoder 传送门 感觉挺典的,~~为啥有 2500 啊(~~ 观察发现,反转序列对 影响不大。具体而言,设反转了 ,记 $s = \sum\limits_{i=1}^{n
阅读全文