摘要: 前置芝士: KMP, manachar 告示:本文字符串下标均从 $1$ 开始。 扩展KMP算法提供了一个计算 $Z$ 函数的方法。 求解 $Z$ 函数定义 $Z$ 函数 $z_i$ 表示字符串 $s$ 以下标 $i$ 为开头的后缀与 $s$ 的最长公共前缀。 根据定义, $z_1 = n$, $n 阅读全文
posted @ 2023-01-09 14:08 LikC1606 阅读(33) 评论(0) 推荐(0)
摘要: ~~NOIP的蓝题果然还是好难啊啊啊啊~~ 前言: 作为一道 NOIP 的真题, 这道题放在 T2 难度并不是特别大,不过考点还是比较偏的,扩展KMP和树状数组的组合,并且还带有一定的思维难度,估计是当年不少人低分的题目,同时也给了一些人翻盘的机会。总而言之, 是道好题。 Description: 阅读全文
posted @ 2023-01-09 14:05 LikC1606 阅读(77) 评论(0) 推荐(0)
摘要: 一道思维难度较高的 KMP 题目,对 border 性质要求较高。 Description 给定一个字符串 $s$, 求长度最小的前缀 $t$ 满足"匹配"完 $s$,这里的"匹配"可以看原题目,不太好描述,建议根据样例手玩一下。 Solution 1 考虑 fail 树。$n$ 为 $s$ 的长度 阅读全文
posted @ 2023-01-09 14:04 LikC1606 阅读(154) 评论(0) 推荐(0)
摘要: 确实是一道好题 ~~模拟赛打挂了~~ 题意 给定两个序列 $a,b$,长度分别为 $n,m(1\leq n,m\leq 10^6)$ )。接下来将 $b$ 中的所有元素以任意方式插入序列 $a$ 中任意位置,请找出一种插入方式使结果序列中的逆序对数量最小化,并输出这个最小值。 Solution 模拟 阅读全文
posted @ 2022-10-20 16:16 LikC1606 阅读(38) 评论(0) 推荐(0)
摘要: 二分图的定义 如果一张无向图的 N 个节点(N ≥ 2) 可以分成 A,B 两个非空集合,其中A∩B=Ø,并且在同一个集合内的点之间都没有边相连,那么称这张无向图为一张二分图。A,B 分别称为二分图的左部和右部。 二分图的一些性质: 1.图中不存在奇环。(证明,二分图构成环,必然是 A-B-A 之类 阅读全文
posted @ 2022-03-07 16:27 LikC1606 阅读(241) 评论(0) 推荐(1)
摘要: 题意 一个矩形中,有n个城市’*’,现在这n个城市都要覆盖无线,若放置一个基站,那么它至多可以覆盖相邻的两个城市。 问至少放置多少个基站才能使得所有的城市都覆盖无线? 分析 每一个城市都需要被一个基站覆盖,而一个基站最多覆盖两个城市。为了使基站的数量最少,我们可以考虑让尽可能多的基站覆盖两个城市。设 阅读全文
posted @ 2022-03-02 20:54 LikC1606 阅读(39) 评论(0) 推荐(0)
摘要: 题面 Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. All what t 阅读全文
posted @ 2022-03-01 19:23 LikC1606 阅读(26) 评论(0) 推荐(0)
摘要: 题面 Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the s 阅读全文
posted @ 2022-03-01 18:54 LikC1606 阅读(24) 评论(0) 推荐(0)
摘要: 题面 The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a refrigerator. There are 16 handles on the 阅读全文
posted @ 2022-03-01 18:25 LikC1606 阅读(30) 评论(0) 推荐(0)
摘要: 题面 Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the othe 阅读全文
posted @ 2022-03-01 18:16 LikC1606 阅读(52) 评论(0) 推荐(0)