#P9609. [CERC2019] Crimson Sexy Jalapeños(征集交互库/SPJ)

    ID: 10597 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>博弈论2019交互题Special JudgeICPC

[CERC2019] Crimson Sexy Jalapeños(征集交互库/SPJ)

Background

This problem is translated from CERC 2019Crimson Sexy Jalapeños”.

Problem Description

This is an IO interactive problem.

The core of the poisoned chocolate game is a classic chocolate bar, divided into small squares by a grid of rectangular grooves parallel to the two sides of the chocolate bar. Some squares are poisoned with an extremely bitter substance and are (almost) impossible to digest.

The game is played by two players taking turns. In a valid move, a player must eat a part of the chocolate bar. It is allowed to split the current bar into two smaller bars along one of the grooves, and then eat only one of them. If a player eats a chocolate piece that contains at least one poisoned square, then that player loses the game.

The positions of all poisoned squares are known at the start of the game. All other squares are safe to eat. Each player will try to avoid eating a piece that contains one or more poisoned squares, because when that happens, the player will involuntarily make their personally most hated ugly face, which brings great fun to the other player and to everyone watching.

In this problem, you need to write a program to play the “poisoned chocolate” game. We ignore the parts of the code that simulate making faces and eating chocolate, and only focus on winning moves.

Input Format

The first line contains integers R,C,K (1R,C104; 1K100)R, C, K\ (1\le R, C\le 10^4;\ 1\le K\le 100). RR is the number of rows, CC is the number of columns, and KK is the number of poisoned squares in the chocolate bar.

The next KK lines each contain two integers AA and B (1AR,1BC)B\ (1\le A\le R, 1\le B\le C), representing the coordinates of a poisoned square. The top-left square has coordinates (1,1)(1, 1).

The rest of the input depends on your output. For each of your valid moves, the interactive library will provide one line of input containing either a description of the opponent’s valid move, or the string yuck! indicating that the opponent has lost. In the latter case, your program should terminate.

Output Format

After reading the description of the chocolate bar, you may decide whether to start the game. If you want to play second, output one line containing the string pass. This special string may only appear on the first output line.

After choosing whether to move first or second, for each of your moves output one line containing a description of a valid move. If your program outputs any other content on a line that is not a valid move, then your program will be judged Wrong Answer.

After each move description, flush the buffer. For example, you can use:

  • For C++\text{C++}: fflush(stdout) or cout.flush()
  • For Java\text{Java}: System.out.flush()
  • For Python\text{Python}: stdout.flush().
4 6 2
2 3
4 4

right 2

yuck!




top 1

left 2

3 5 1
2 3

left 1

left 1

right 1

yuck!



pass

right 1

top 1

bottom 1

Hint

Sample format note

To make it easier to explain the interaction order between your program and the interactive library, the sample format is filled with blank lines. Please note that there will be no blank lines in the actual interaction.

Sample 11 explanation

Translated by ChatGPT 5