摘要:
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 - 阅读全文