复制标题的时候才发现这一场题目首字母和编号相同诶
Description
给出一个字符串 (s),每次可以在任意位置增删aa
,bbb
,ababab
,问能形成多少种不同的长度为 (L) 的串。
Solution
又是手建自动机的神仙题!
这个操作显然是可逆的,故考虑把每个串表示成等价的最短的串。
手玩一下,发现只有 (12) 种本质不同的最短的串。
然后手玩一下这些转移,只有 (24) 种很快就出来了。
[egin{align*}
emptysetstackrel a{longrightarrow}a & & emptysetstackrel b{longrightarrow}b \
astackrel a{longrightarrow}emptyset & & astackrel b{longrightarrow}ab \
bstackrel a{longrightarrow}ba & & bstackrel b{longrightarrow}bb \
abstackrel a{longrightarrow}aba & & abstackrel b{longrightarrow}abb \
bastackrel a{longrightarrow}b & & bastackrel b{longrightarrow}bab \
bbstackrel a{longrightarrow}bba & & bbstackrel b{longrightarrow}emptyset \
abastackrel a{longrightarrow}ab & & abastackrel b{longrightarrow}bba \
abbstackrel a{longrightarrow}bab & & abbstackrel b{longrightarrow}a \
babstackrel a{longrightarrow}abb & & babstackrel b{longrightarrow}babb \
bbastackrel a{longrightarrow}bb & & bbastackrel b{longrightarrow}bbab \
babbstackrel a{longrightarrow}bbab & & babbstackrel b{longrightarrow}ba \
bbabstackrel a{longrightarrow}babb & & bbabstackrel b{longrightarrow}aba \
end{align*}
]
弄出这个以后转移用矩阵加速就可以了。
SV:你看这只是一个正四面体的旋转群((12) 阶),下次我出一个正二十面体的旋转群((60) 阶)看你怎么手模(毒瘤!)。