#P12533. [XJTUPC 2025] 9-Nine

    ID: 12368 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>搜索2025Special JudgeO2优化广度优先搜索 BFS构造高校校赛

[XJTUPC 2025] 9-Nine

Description

Artifact, a kind of magic item from anime called Rinnetense No Moubiusu Ring , written by City Shiromitsukawa, comes true unpredictably! The User can get his or her own special ability. All of this story begins from that earthquake.

"Thousands of years ago, the earth and the magic world were connected. The Artifact is just a magic item from the magic world. Because of lots of things, there was set up an organization called Sefiruto (Tree of Kabbalah), retrieving all of the Artifacts, using magic to prevent the connection of two worlds. However, attributing to the earthquake, the gate was broken, and the Artifact came to this world again." ------ the muppet named Sophitia said so.

With the help of Sophitia, our male lead KakeruNimi leads the four female leads in a fierce struggle against the villains, ultimately successfully preventing them from making unforgivable mistakes using Artifacts. After that, KakeruNimi and Sophitia decide to disconnect the two worlds, reusing the magic gate.

The lock of the gate can be seen as two black and white matrices with size 9×99 \times 9, and either KakeruNimi or Sophitia can control the matrix in his or her own world. They can:

  • KakeruNimi turns the matrix in his world to rotate by 9090 degrees to the left or right;
  • Sophitia turns the matrix in her world to rotate by 9090 degrees to the left or right (two matrices can be rotated independently);
  • KakeruNimi and Sophitia choose the same column of the matrices in two worlds and then swap them;

When KakeruNimi's matrix is all white, as soon as Sophitia's matrix is all black, the gate will be locked, and then everyone can return to normal life.

Time is limited, please YOU --- our "Nine" --- help them complete this task within 999999 steps.

That being said, the question maker was warned that the question was too difficult, so he decided to narrow down the data range!

Specifically, reduce the side length of the square matrix to 33 and the number of steps to 9×9=819\times 9=81!

Formally speaking, there are two 3×33 \times 3 01 matrices AA and BB, and you can do the following:

  • Operation 11: Select matrix AA or BB and rotate it 9090 degrees to the left or right;
  • Operation 22: Select the integer kk (1k31 \le k \le 3) and swap the kk-th column of the two matrices.

Please convert AA into a full 0 matrix within 8181 operations, ensuring that BB is always a full 1 matrix at this time.

Input Format

Line 131 \sim 3, each line is a 01 string of length 33, representing the initial state of matrix AA.

Line 464 \sim 6, each line is a 01 string of length 33, representing the initial state of matrix BB.

The data guarantees that within a finite number of operations, AA can be transformed into a full 0 matrix and BB into a full 1 matrix.

Output Format

The first line should be an integer NN (0N810 \le N \le 81), indicating that you need to perform a total of NN operations.

The next NN lines should be in the following format:

  • If you choose to use operation 11 for an item, please output the matrix name and rotation direction. Specifically:
    • If you want to rotate the AA matrix to the left by 9090 degrees , output AL\tt{AL};
    • If you want to rotate the AA matrix to the right by 9090 degrees, output AR\tt{AR};
    • If you want to rotate the BB matrix to the left by 9090 degrees , output BL\tt{BL};
    • If you want to rotate the BB matrix to the right by 9090 degrees, output BR\tt{BR}.
  • If you choose to use operation 22 for an item, please output C\tt{C} and column number. For example, if you want to swap the 22nd column of two matrices, please output C2\tt{C2}.

Where, rotating a matrix to the left means rotating it counterclockwise; Rotating a matrix to the right means rotating it clockwise.

Please note: Do not output extra spaces at the end of the line or carriage returns at the end of the text.

100
000
000
111
111
011
9
BL
BL
BL
AL
C1
AL
C1
AR
C1

Hint

It can be proven that, under the condition of valid data, there must be a solution to the original question within step 999999, and the weakened version of the question must have a solution within step 8181.

The most important thing is that 9-nine- will release a new work this year and is expected to be launched on Steam in the winter.