跳到正文

个人记录

pjudge 2025.2.15 模拟赛记录

TallBanana约 2 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 2 分钟

版本

  1. v1当前

Public Round #15

T1

关键在于求出 F(len,x)F(\mathsf{len},x) 表示长度为 len\mathsf{len} 的字符串的最小循环为 xx 的方案数。

第一想法是:F(len,1),F(len,2),…,F(len,len)F(\mathsf{len},1),F(\mathsf{len},2),\dots,F(\mathsf{len},\mathsf{len}) 应当都是相等的。然而这是错误的,例如 f(abcabc),它只能等于 11,这提示我们,当字符串有整周期时,只会给第一个周期进行贡献。如果我们把有整周期的字符串去掉,就确实满足 F(len,1∼len)F(\mathsf{len},1\sim \mathsf{len}) 是相等的了。

令 hih_i 表示长度为 ii 的、满足不存在循环节的字符串的个数,容易容斥 O(nlog⁡n)O(n\log n) 求出。

于是 F(len,x)=(∑i∣len,x≤i<lenhii)+26len−∑i∣len,i<lenhilenF(\mathsf{len},x)=(\sum_{i|\mathsf{len},x\le i<\mathsf{len}}\frac{h_i}{i})+\frac{26^\mathsf{len}-\sum_{i|\mathsf{len},i<\mathsf{len}}h_i}{\mathsf{len}},其中前面的和式表示那些有循环节的字符串,我们把它们在最小循环节处算上。我们可以在 O(d(n))O(d(n)) 的复杂度内计算单点的值。

那么我们相邻两个的答案为 126a+b∑i=1min⁡(a,b)F(a,i)F(b,i)\frac{1}{26^{a+b}}\sum_{i=1}^{\min(a,b)}F(a,i)F(b,i),暴力求是 O(n2d(n))O(n^2d(n)) 的,无法通过。

将 F(len,x)F(\mathsf{len},x) 改写为 A(len,x)+B(len)A(\mathsf{len},x)+B(\mathsf{len}),于是发现 FF 是由 O(n)O(\sqrt n) 个相同的段组合而成的。于是分段合并即可。复杂度 O(nn)O(n\sqrt n)。

T2

由于我过于摸鱼了,没听懂。

T3

原文