#P9609. [CERC2019] Crimson Sexy Jalapeños(征集交互库/SPJ)
[CERC2019] Crimson Sexy Jalapeños(征集交互库/SPJ)
Background
This problem is translated from CERC 2019 “Crimson 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 . is the number of rows, is the number of columns, and is the number of poisoned squares in the chocolate bar.
The next lines each contain two integers and , representing the coordinates of a poisoned square. The top-left square has coordinates .
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 :
fflush(stdout)orcout.flush(); - For :
System.out.flush(); - For :
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 explanation

Translated by ChatGPT 5