11 2019 档案
摘要:关于数位和的趣题。
阅读全文
摘要:An interesting interactive problem involving binary search.
阅读全文
摘要:A greedy problem involving trees where we are "to make things better in the future".
阅读全文
摘要:An interesting problem about subsequnces.
阅读全文
摘要:A DP problem about inversion number between two permutations.
阅读全文
摘要:"题目" 好题。没想出解法。 官方题解: 这个解法和 "Small Multiple" 那道题的解法有异曲同工之妙。 扩展 若把 $\mathsf{or}$ 改成 $\mathsf{and}$ 或者 $\mathsf{xor}$ 怎么解? 代码 c++ int main() { int n; sca
阅读全文
摘要:"题目链接" 我的思路略复杂,这里介绍一个比较简洁的做法。 对于 $b \le \sqrt{N}$,暴力枚举 $b$。对于 $b \sqrt{N}$, 注意到在 $b$ 进制下 $N$ 至多有 2 个数位,且最高位的取值小于 $\sqrt{N}$,此时可以暴力枚举最高位上的数字。 扩展 若数据范围扩
阅读全文
摘要:Some useful sentences and expressions for writing editorial.
阅读全文
摘要:设共有 $N = \sum\_{i=1}^{9} A_i$ 个数字。先把 $N$ 个数字任意分成两组 $A$ 和 $B$,$A$ 中有 $N_A = \floor{N/2}$ 个数字,$B$ 中有 $N_B=\ceil{N/2}$ 个数字。将 $A$ 中数字之和记作 $S_A$,$B$ 中数字之和记
阅读全文
摘要:Links to some interesting people and things on the Web.
阅读全文
摘要:给定数组 $a_1, a_2, \dots, a_N$。 hihoCoder 1849 "子数组的中位数" 中位数数定义为排序后第 $\floor{(N+1)/2}$ 个数。 中位数大于 $k$ 等价于数组中大于等于 $k$ 的数超过一半。 定义数组 $b_1, b_2, \dots, b_N$,
阅读全文
摘要:分析 必要条件: ① $\sum_{i=1}^{n} s_i = \sum_{i=1}^{n} t_i$ 预处理: 将 $s, t$ 从小到大排序。 尝试一 首尾匹配。例子 s = 2, 2, 4, 7, 9 t = 4, 5, 5, 5, 5 4, 2, 4, 7, 7 4, 4, 4, 7, 5
阅读全文
摘要:Observations 对一个长为 $2N$ 的序列重复下述操作:取走两个相邻且不同的元素。最后能把序列取空的充要条件是序列中不存在出现超过 $N$ 次的元素。 证明:必要性,取 $N$ 次最多能取走 $N$ 个同样的元素,因此同样的元素不能超过 $N$ 个。 充分性可以用归纳法证明。对于元素 A
阅读全文
摘要:Tips and tools for blog post authoring.
阅读全文
摘要:"题目链接" "题解" 最小的 bounding box 一定可以在四个时间段的最左端点和最右端点之间取到。 举例言之,设四个时间段分别是 (2, 5), (7, 10), (4, 9), ( 10, 20); 则最小的 bounding box 一定可以在 (2, 20) 这段时间内取到,我们只需
阅读全文
摘要:$\require{enclose}$ 必要条件 一方面 $\sum\_{i=1}^{N}(a_i + b_i) \le \sum\_{i=1}^{N} c_i \implies 2\sum\_{i=1}^{N} c_i \ge \sum\_{i=1}^{N}(a_i + b_i + c_i) =
阅读全文
摘要:Score: 600 points Approach 固定横坐标 $x$,考虑横坐标为 $x$ 的竖直线上最多可以有几个点。 Observations 若最初两条竖直线 $x_1$、$x_2$ 上都有一个纵坐标是 $y$ 的点,则 这两条竖直线上的点可以“合并” 最终这两条竖直线上的点必定是一样的
阅读全文
摘要:The problem Find three non negative integers $x$, $y$ and $z$ that meet the following conditions: \begin{cases} wx + dy = p, \\\\ x + y + z = n. \end{
阅读全文
摘要:Problem Statement Let us define the oddness of a permutation \(p = \\{p_1, p_2, \dots, p_n\\}\) of \(\\{1, 2, \dots, n\\}\) as \(\sum_{i=1}^{n} | i -
阅读全文
摘要:Observations ① 从 $1$ 到 $N$ 的最短路一定是不走回头路的。所谓走回头路是指从序号大的点走到序号小的点。 证明 :首先,任意从 $1$ 到 $N$ 的路径的最后一步一定不是回头路。假设存在一条从 $1$ 到 $N$ 的最短路走了回头路,并设这条路最后一次回头是从 $u$ 到 $
阅读全文
摘要:① $a_1 + a_2 + \dots + a_n = r$ 的解数。 $a_i, r \in \mathbb{Z}_{\ge 0}$ 挡板法。$\binom{n + r 1}{r}$ ② $a_1 + a_2 + \dots + a_n \le r$ 的解数。 $a_i, r \in \math
阅读全文
摘要:纠正我对 01 BFS 问题的错误认识。 我一直以为对于 01 BFS,每次点 $u$ 出队时,对于 $u$ 的邻接边表中的边,只要先松弛边权为 0 的边再松弛边权为 1 的边就能保证 每个点只入队一次 。最近我发现我错了,例子: 按照上述做法,入队序列是 1, 2, 3, 4, 5, 4, 5。4
阅读全文
摘要:I learned this trick from "hitonanode" 's "submission" on AtCoder. The trick is like What I used to do is like using this trick, the code becomes I th
阅读全文
摘要:考虑 DP。 状态 令 $f[\ell][x]$ 表示长度为 $\ell$,首项不超过 $x$ 的序列的个数。 答案是 $f[K][N]$。 有递推 $f[\ell][x] = f[\ell][x 1] + f[\ell 1][\floor{N/x}]$。照这个递推式求解,复杂度度太高;把它改成 $
阅读全文

浙公网安备 33010602011771号