11 2018 档案
摘要:用 $h_n$ 表示按秩合并 $n$ 个点所得树的最大高度。 有 $h_1 = 0, h_2 = 1, h_3 = 1, h_4 = 2, h_5 = 2, \dots$ 有如下地推: \\[ h_n = \max_{1\le i\le n 1} \max(h_i, h_{n i}) + [h_i
阅读全文
摘要:"题目" 从 Kruskal 算法的角度来思考这个问题。 考虑 $n$ 个点的“空图”(即没有边的图)。 先将 $m_2$ 条无权值的边加到图中,得到一个森林。 按边权从小到大的顺序枚举 $m_1$ 条有权值的边。 对于边 $e\colon(u, v, w)$,若将 $e$ 加入图中之后 (i) 会
阅读全文
摘要:"题目" 用 $1,2 ,3 \dots, N$ 代表 $N$ 首歌。设想有 $L$ 个格子排成一排,编号 $1$ 到 $L$ 。考虑将这些数字挨个填进格子里的情形。假设当前要往第 $i$ 个格子里填一个数字(此时前面 $i 1$个坑里都已经填上数字了)若只考虑相邻两个数字不能相同这个条件,则第 $
阅读全文
摘要:2.1 Inclusion-Exclusion Roughly speaking, a "sieve method" in enumerative combinatorics is a method for determining the cardinality of a set \(S\) tha
阅读全文
摘要:在集合 $[n]$ 上使用容斥原理。 固定 $i$,考虑有多少个 $j \in [n]$ 满足 $\gcd(i, j) = \gcd(a_i, a_j) = 1$,将此数目记作 $f_i$。暂时不考虑条件 $ i \le j $ 。 考虑 $[n]$ 的某些子集。$S_{x,y} := \\{ i\
阅读全文
摘要:设在第 $x$ 天二人都 lucky,则有 $\DeclareMathOperator{\lcm}{lcm}$ $ x = y_a t_a + R_a $ $ x= y_b t_ b + R_b$ 约束条件: $ l_a \le R_a \le r_a$,$l_b \le R_b \le r_b$
阅读全文
摘要:第一次注意到这个问题。 cppreference 上的条目: "lower_bound" "upper_bound" C++17 草案 N4659 lower_bound Requires: The elements of shall be partitioned with respect to t
阅读全文