HBC237096[ZJOI2013]K大数查询,二分,树套树,线段树,数据结构,分治Let's Swap题解

八贝勒 算法基础篇 53 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
Joseph developed an editing software called Pandote recently, and now he is testing it to make sure it works correctly, otherwise, he will probably get fired!Joseph starts his testing by implementing copying and pasting as well as reversing operations to the string on the Pandote. More specifically, in each step, if the string on the screen is SSS, he will do the following operations in order. Choose a prefix of length ll ~ l, then SSS can be denoted by ABAB~AB. Note that the string BBB can be empty. Swap the two parts and get the string BABABA. Reverse the whole string and get the string r^rr. However, since the function of Pandote is limited, there are only two different lengths l1l_1l1 and l2l_2l2 of prefix he can choose in each step. Now Joseph wants to know whether he can convert the string SSS to TTT through several steps.

Joseph developed an editing software called Pandote recently, and now he is testing it to make sure it works correctly, otherwise, he will probably get fired! Joseph starts his testing by implementing copying and pasting as well as reversing operations to the string on the Pandote. More specifically, in each step, if the string on the screen is SSS, he will do the following operations in order. Choose a prefix of length l (1≤l≤∣S∣)l ~ (1 leq l leq |S|)l (1≤l≤∣S∣), then SSS can be denoted by AB (∣A∣=l)AB~(|A|=l)AB (∣A∣=l). Note that the string BBB can be empty. Swap the two parts and get the string BABABA. Reverse the whole string and get the string (BA)r(BA)^r(BA)r. However, since the function of Pandote is limited, there are only two different lengths l1l_1l1​ and l2l_2l2​ of prefix he can choose in each step. Now Joseph wants to know whether he can convert the string SSS to TTT through several (possibly zero) steps.

HBC237096[ZJOI2013]K大数查询,二分,树套树,线段树,数据结构,分治Let's Swap题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC237096[ZJOI2013]K大数查询 二分 树套树 线段树 数据结构 分治Let's Swap题解