#P11773. 巅峰手速

    ID: 11177 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>洛谷原创Special JudgeO2优化构造洛谷月赛

巅峰手速

Description

Aling gives Longya nn cards, which have been put on the table neatly in a row. The ii-th card on the table from the left has a number aia_i written on it. Longya needs to make the written numbers arranged in a non-descending order with any number of operations decribed below:

  • draw out the kk-th card from the left and put it on either the leftmost or the rightmost side of the cards, where kk is a given constant.

Longya wants to know if he can reach the goal and also a simple plan if possible.

Input Format

The first row of input contains an integer TT — the number of test cases.

Each test case contains two rows:

The first row of a tast case contains two integers n,kn,k — the amount of the cards and the given constant.

The Second row of a test case contains nn integers aia_i — the written numbers on each card.

Output Format

For all tests, output any row in the format described below:

  • If Longya can't reach the goal, output a line of a single No.

  • If Longya can reach the goal, output a line of a single Yes, then any number of rows to describe your plan in the format of l c or r c, denoting that he will do c consecutive operations to move the kk-th card to the leftmost or the rightmost side of the sequence. Finally ouput a line of a single o denoting the end of the plan.

Your score will be related to the number of rows of your plan (instead of the number of operations). (Further information is given in the Score Calculation part below.)

5
3 2
3 2 1
7 3
4 1 3 2 5 7 6
3 3
2 1 3
7 5
1 2 3 4 5 6 7
6 4
1 1 4 5 1 4
Yes
l 1
r 1
l 1
o
No
No
Yes
o
Yes
r 1
l 1
o

Hint

Sample Explanation

For test case 1:

Put the second card (22) to the leftmost side, making the sequence 2,3,12,3,1.

Put the second card (33) to the rightmost side, making the sequence 2,1,32,1,3.

Put the second card (11) to the leftmost side, making the sequence 1,2,31,2,3.

The sequence is now non-descending, thus the operations end.

Score Calculation

The score of a test data is the minimum score of the test cases.

In a test case, if you successfully determined if Longya can reach the goal, you will gain 20%20\% of the maximum point. And if your plan is also right, you can gain a certain ratio of score where the ratio is described below:

Number of Rows Ratio
>7n>7n 40%40\%
7n\le7n 60%60\%
5n\le5n 80%80\%
3n\le3n 100%100\%

Note

To make the your debug easier, we attached a checker file for calculating your score locally. The usage is described below in the next part.

If your output format is wrong, you will gain 00 point. Therefore if you know whether it is possible to reach the goal but you can't construct a plan, please still output an o after your Yes to represent the end of your plan.

To avoid meaningless repeatition, you should guarantee 1cn1\leq c\leq n for every line of your plan.

Usage of the checker

Download files checker.cpp and testlib.h from the buttom of the Chinese statement. Put them in the same folder and run command g++ checker.cpp -o checker -std=c++14 in the directory to get the executable file checker.exe (Windows) / checker (Linux).

Assume your custom input is in in.txt and you program output is out.txt. Since the checker can't determine whether it is possible to reach the goal, you should create an answer file (Assume it is ans.txt), and input the possibility one per line. For example, the answer file of the sample input should be:

Yes
No
No
Yes
Yes

Put the input, output and answer file in the same folder with the excutable checker file.

  • run .\checker.exe in.txt out.txt ans.txt if you are in Windows Powershell.

  • run ./checker in.txt out.txt ans.txt if you are in Linux Terminal.

There are three possible kinds output of the checker: wrong answer / ok / points x, which means you can gain score at a ratio of 0%0\% / 100%100\% / x.

Constraints

There exist subtasks and subtask dependency. Your score in a subtask is the minimum score of the datas in the subtask and the depended subtasks. A subtask will be depended on all of which is a subset of it.

Subtask ID TT nn kk Score
11 105\le10^5 =5=5 [1,n]\in[1,n] 1010
22 100\le100 500\le500 4040
33 105\le10^5 2×105\le2\times10^5 =2=2 2020
44 [1,n]\in[1,n] 3030

For all tests, it is guaranteed that 1T1051\le T\le10^51kn2×1051\le k\le n\le 2\times10^5n5×105\sum n\le5\times10^{5}1ai1091\le a_i\le 10^9.