#P11773. 巅峰手速
巅峰手速
Description
Aling gives Longya cards, which have been put on the table neatly in a row. The -th card on the table from the left has a number 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 -th card from the left and put it on either the leftmost or the rightmost side of the cards, where 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 — the number of test cases.
Each test case contains two rows:
The first row of a tast case contains two integers — the amount of the cards and the given constant.
The Second row of a test case contains integers — 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 ofl corr c, denoting that he will docconsecutive operations to move the -th card to the leftmost or the rightmost side of the sequence. Finally ouput a line of a singleodenoting 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 () to the leftmost side, making the sequence .
Put the second card () to the rightmost side, making the sequence .
Put the second card () to the leftmost side, making the sequence .
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 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 |
|---|---|
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 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 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.txtif you are in Windows Powershell. -
run
./checker in.txt out.txt ans.txtif 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 / / 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 | Score | |||
|---|---|---|---|---|
For all tests, it is guaranteed that ,,,.
京公网安备 11011102002149号