版本比较
题解:P13885 [蓝桥杯 2023 省 Java/Python A] 反异或 01 串
正文
增加 1 行删除 1 行
12345667891054 行未改动前置知识:[Manacher](https://www.luogu.com.cn/problem/P3805)。
此题就是让我们将一个空 $01$ 串通过添加 $1$、添加 $0$ 和反异或操作变成目标串。有几个关键结论:
1. 反异或后的字符串是回文的。
假设有两个待异或的串 $a,b$,其中 $a=rev\left(b\right)$。\ $\because \forall i\left(1\le i\le \left|a\right|\right),a_i=a_{\left|a\right|-i+1}$,且 $\forall j\left(1\le j\le\left|b\right|\right),b_j=b_{\left|b\right|-j+1}$,且 $\left|a\right|=\left|b\right|$。\ $\therefore \forall i\left(1\le i\le \left|a\right|\right),a_i\oplus b_i=a_{\left|a\right|-i+1}\oplus b_{\left|b\right|-i+1}$。\ $\therefore\;$反异或后的字符串是回文的。54 行未改动