随笔分类 -  未能一眼看穿

缺乏 insigt,把简单题搞复杂了。
摘要:一道不那么直白的逆序数计算问题。 阅读全文
posted @ 2020-10-16 11:13 Pat 阅读(174) 评论(0) 推荐(0)
摘要:Another not-so-easy-for-me problem. 阅读全文
posted @ 2020-01-03 18:50 Pat 阅读(388) 评论(0) 推荐(0)
摘要:An interesting interactive problem involving binary search. 阅读全文
posted @ 2019-11-24 22:00 Pat 阅读(263) 评论(0) 推荐(0)
摘要:An interesting problem about subsequnces. 阅读全文
posted @ 2019-11-22 12:56 Pat 阅读(210) 评论(0) 推荐(0)
摘要: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{ 阅读全文
posted @ 2019-11-11 18:11 Pat 阅读(153) 评论(0) 推荐(0)
摘要:Observations ① 从 $1$ 到 $N$ 的最短路一定是不走回头路的。所谓走回头路是指从序号大的点走到序号小的点。 证明 :首先,任意从 $1$ 到 $N$ 的路径的最后一步一定不是回头路。假设存在一条从 $1$ 到 $N$ 的最短路走了回头路,并设这条路最后一次回头是从 $u$ 到 $ 阅读全文
posted @ 2019-11-10 03:14 Pat 阅读(439) 评论(5) 推荐(0)
摘要:Problem Check if a positive integer $n$ can be written as sum of a positive integer and reverse of that integer. Here, reverse of a positive integer i 阅读全文
posted @ 2019-09-23 01:08 Pat 阅读(398) 评论(0) 推荐(0)
摘要:题目大意 有 $n$ 个不同的糖果,从 $1$ 到 $n$ 编号。有 $k$ 个客人。要用糖果招待客人。 对于每个客人,这些糖果中恰有两个是其最爱。第 $i$ 个客人最爱的糖果编号是 $x_i$ 和 $y_i$ 。 将 $k$ 个客人任意排列,他们按顺序去拿自己最爱的糖果。 客人要拿到至少一个最爱的 阅读全文
posted @ 2019-09-16 23:36 Pat 阅读(392) 评论(0) 推荐(1)
摘要:"题目链接" 分析 异或运算满足「三角不等式」。 $\forall a, b, c \in \mathbb{Z}\_{\ge 0}$,有 $a \xor b \le (a \xor c) + (c \xor b)$ 。 证明:容易证明:$\forall a, b \in \mathbb{Z}_{\g 阅读全文
posted @ 2019-08-25 17:29 Pat 阅读(149) 评论(0) 推荐(0)
摘要:"题目链接" 题目大意 给定一个长为 $n$ 的数组 $s$,下标从 $0$ 开始。$ 3 \le n \le 10^5$,$ 10^9 \le s_i \le 10^9$,$s_0 = s_{n 1} = 0$ 。 一只青蛙要在数组 $s$ 上玩一个游戏。游戏规则如下 初始时青蛙的位置(即青蛙所在 阅读全文
posted @ 2019-06-01 12:29 Pat 阅读(310) 评论(0) 推荐(0)
摘要:https://codeforces.com/contest/1158/problem/C 题目 已知 $p_1, p_2, \dots, p_n$ 是 $1$ 到 $n$ 的一个排列。 给出关于这个未知排列的一些描述:对于某些下标 $i$,$p_i$ 右边第一个大于 $p_i$ 的数的下标是 $R 阅读全文
posted @ 2019-05-17 00:54 Pat 阅读(377) 评论(0) 推荐(0)
摘要:"题目" $a, x$ 是正整数。显然有 \begin{aligned} x \ge 2x \pmod{a} \implies a \le 2x \end{aligned} 若 $x \le a$ 则 \begin{aligned} x 2x \end{aligned} 证明 首先,$x x$,当 阅读全文
posted @ 2019-01-23 10:43 Pat 阅读(286) 评论(0) 推荐(1)
摘要:解法 这题比赛时过的人很多,我却没思路,糊里糊涂写了个强联通分量,得了 80 分。 这题思路是这样的。 一个替换操作可以看做一个有向边,所以题目实际上给出了一个有向图 $G$,一个节点代表一个字母。 注意题目要求每个操作都必须执行一次。 关于自环 首先注意到自环是没有意义的,因此处理输入时把自环忽略 阅读全文
posted @ 2018-12-24 21:26 Pat 阅读(228) 评论(0) 推荐(0)
摘要:与坐标轴平行的矩形和圆的位置关系。 分两种情况。 圆与矩形交集不为空 此时答案为零。问题归结为如何判断圆与矩形交集不为空。 先排除矩形顶点在圆内或圆心在矩形内。 此时,若矩形与圆交集不为空,则必有矩形的某条边穿过圆(「穿过圆」也可表述为「割圆」,「线段穿过圆」的确切定义为「线段与圆周有两个交点」)。 阅读全文
posted @ 2018-12-16 16:29 Pat 阅读(273) 评论(0) 推荐(0)
摘要:"题目" 用 $1,2 ,3 \dots, N$ 代表 $N$ 首歌。设想有 $L$ 个格子排成一排,编号 $1$ 到 $L$ 。考虑将这些数字挨个填进格子里的情形。假设当前要往第 $i$ 个格子里填一个数字(此时前面 $i 1$个坑里都已经填上数字了)若只考虑相邻两个数字不能相同这个条件,则第 $ 阅读全文
posted @ 2018-11-18 23:46 Pat 阅读(170) 评论(0) 推荐(0)
摘要:在集合 $[n]$ 上使用容斥原理。 固定 $i$,考虑有多少个 $j \in [n]$ 满足 $\gcd(i, j) = \gcd(a_i, a_j) = 1$,将此数目记作 $f_i$。暂时不考虑条件 $ i \le j $ 。 考虑 $[n]$ 的某些子集。$S_{x,y} := \\{ i\ 阅读全文
posted @ 2018-11-14 13:30 Pat 阅读(302) 评论(0) 推荐(0)
摘要:"题目" 对于 $1$ 到 $n$ 的一个排列,用 $\mathsf{LIS}$ 表示其最长上升子序列的长度,用 $\mathsf{LDS}$ 表示其最长下降子序列的长度。输出一个使得 $\mathsf{LIS} + \mathsf{LDS}$ 最小的排列。 分析 这道题是 CF Round 502 阅读全文
posted @ 2018-08-09 15:11 Pat 阅读(478) 评论(0) 推荐(1)
摘要:"题目" 题目大意 给定一棵有 $n$ 个节点的树,边的权值每天变化。对于第 $i$ 条边,在第 $0$ 天,其权值为 $c_i$,每天权值变化 $a_i$(即,在第 $k$ 天,其权值为 $c_i + k a_i$)。求在第 $0$ 天到第 $D$ 天之间,树的直径的最小值,并且求出最早在哪一天达 阅读全文
posted @ 2018-07-23 10:35 Pat 阅读(310) 评论(4) 推荐(0)
摘要:给定两正整数 $a, b$ 。给定序列 $s_0, s_1, \dots, s_n,s_i$ 等于 $1$ 或 $ 1$,并且已知 $s$ 是周期为 $k$ 的序列并且 $k\mid (n+1)$,输入只给出序列 $s$ 的前 $k$ 项。 Find out the non negative rem 阅读全文
posted @ 2018-04-21 14:06 Pat 阅读(579) 评论(0) 推荐(0)