#P3614. yyy 棋 II

    ID: 2422 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>洛谷原创提交答案Special Judge洛谷月赛

yyy 棋 II

Description

Our brilliant yyy once got bored and invented a game that took the world by storm. To commemorate this great invention, he named it “yyy Chess.”

In one scenario, the board looks like this:

xx...xx
xx...xx
.......
.......
.......
xx...xx
xx...xx

In this case, it is a 7×77\times7 board. You can move on ., but not on x. There is only one type of piece, which we denote as Y.

The initial pieces and obstacles are given by the system. Suppose it looks like this:

xx...xx
xx.Y.xx
...Y...
.......
.......
xx...xx
xx...xx

The rules are simple. Any piece can, and only can, jump over one adjacent piece in the up, down, left, or right direction, moving two squares, and the destination must be empty and not x. After the jump, the jumped-over piece disappears. For example, in the configuration above, we can jump the upper piece downward, after which it becomes:

xx...xx
xx...xx
.......
...Y...
.......
xx...xx
xx...xx

Our goal is to eliminate as many pieces as possible through a sequence of moves, ideally leaving exactly one piece. Since yyy has OCD, he also wants the last piece to stay at the center.

Input Format

All input data yyychess1.in ~ yyychess10.in correspond to 1010 tasks.

For each task:

The first line contains an integer NN, the size of the board.

For convenience, we define coordinate (i,j)(i, j) as row ii, column jj.

The next line contains a natural number MM.

  • If M=0M=0, then

Next comes an N×NN\times N matrix. We use x to denote an unplayable cell, o for an empty playable cell, and y for a cell with a piece. Characters are not separated by spaces.

  • If M>0M>0, then

Next come MM lines, each with two numbers, giving the coordinates of each piece. In this case, there are no obstacle cells.

Output Format

Output several lines, each representing a move.

For each line, output two numbers and one letter. The two numbers represent (i,j)(i,j), i.e., the coordinate of the piece, and the letter is one of UDLR, representing a jump in the up, down, left, or right direction, respectively.

7
0
xxoooxx
xxoyoxx
oooyooo
ooooooo
ooooooo
xxoooxx
xxoooxx
2 4 D
7
2
2 4
3 4
3 4 U

Hint

Sample Explanation

The two samples describe the same board; the second one simply has no obstacle cells.

With the first sample output, you can score 100%100\%.

With the second sample output, you can only score 90%90\%, because the final piece is not at the center (n+12,n+12)(\frac{n+1}{2},\frac{n+1}{2}).

Scoring Rules

If your answer is valid, and exactly one piece remains at the very center, you score 100%100\% for that testcase.

If your answer is valid, and exactly one piece remains but not at the center, you score 90%90\% for that testcase.

If your answer is valid, and 22, 33, or 44/55 pieces remain, you score 80%80\%, 60%60\%, or 40%40\% for that testcase, respectively.

Otherwise, including having illegal moves or more than 55 pieces remaining, you score 00 for that testcase.

The archive provides checker.exe for preliminary use.

Method

Unzip all files, then run on the command line: checker.exe yyychess1.in youranswer.txt youranswer.txt (the last two are your output file; please enter it twice), and it will tell you the result.

Translated by ChatGPT 5