#7371. [ICPC 2024 Chengdu R] Arrow a Row
[ICPC 2024 Chengdu R] Arrow a Row
[ICPC 2024 Chengdu R] Arrow a Row
题目描述
Define an "arrow string" as a string that meets the following conditions:- The length of the string is at least .
- The string starts with and ends with .
- The rest of the string consists only of .
For example, and are valid arrow strings, while and are not.
Sauden gives you a string of length , consisting of and . You need to create by performing a series of painting operations on a string of the same length that consists entirely of . In one painting operation, you can choose a substring of length at least and transform it into an arrow string. The total number of operations you perform cannot exceed .
If it is impossible to obtain the string using no more than painting operations, output . Otherwise, output and provide the details of the painting operations. If there are multiple solutions, output any.
输入格式
The first line contains a single integer $T$ ($1\le T\le 10^4$), indicating the number of test cases.Each test case contains a string of length () in a single line, consisting only of and .
It is guaranteed that the sum of over all test cases does not exceed .
输出格式
For each test case, if the given string cannot be obtained by performing no more than $n$ painting operations, output $\texttt{No}$ in a single line. Otherwise, output $\texttt{Yes}$ and a positive integer $m$ ($1 \le m \le n$), which denotes the number of painting operations to perform. Then output $m$ lines, each contains two integers $p$ ($1\le p\le n-4$) and $l$ ($5\le l\le n+1-p$), indicating the starting position of the selected substring and its length.4
>>->>>
>>>->
>>>>>
>->>>>>>
Yes 2
1 5
2 5
No
No
Yes 2
2 7
1 5
提示
For the fourth test case in the example, the painting process is shown below::::align{center} $\tt{*}\underline{\tt{>}\tt{-}\tt{-}\tt{-}\tt{>}\tt{>}\tt{>}}$ $\underline{\tt{>}\tt{-}\tt{>}\tt{>}\tt{>}}\tt{>}\tt{>}\tt{>}$ ::: 标签: P15072|2024|Special Judge|ICPC|成都