QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 256 MB Points totaux : 100 Interactif

#18098. Game with dices

Statistiques

This problem is interactive.

At her loft, Taja found an ancient tabletop game, which she managed to win only from time to time. Show Taja, how to win this game with a guarantee.

problem_18098_4b1c7a2c6460a61aca0b0094efd68c47.png

Game equipment consists of round piece with a radius of $1$, which has an arrow drawn on top of it, two dices and 360 stickers. Every sticker has unique integer written on it, from $0^\circ$ to $359^\circ$.

Before starting to play one should mark a point on a table, then place round piece on the table, then choose 12 different stickers, and 6 of them stick on the first dice, and another six on the second dice.

The goal is to cover the marked point with the piece. It should be achieved by making turns with the following rule. First, player rolls one of the dice and rotates the piece counterclockwise by amount of degrees written on top of the dice. Then the piece moves towards the arrow by the distance of $10$.

Co-ordinates of the marked point is always $(0, 0)$. Starting position of the center of the piece is $(x, y)$ and satisfies the following constraint:

$$ 2 \le \max(|x|, |y|) \le 500 $$

Number of queries for this problem equals to the number of made turns.

Interaction

Interactor starts with giving coordinates of the center of the piece and direction of its arrow. Then your program should respond with numbers, sticked on both dice. Then for each number of dice given by your program, interactor outputs amount of degrees shown by the dice and says whether the piece reached the goal. If the piece has covered the marked point, then your program should terminate. Otherwise, interactor outputs resulting position of the piece and its arrow, thus initiating next turn.

Output

First two lines of the output should contain 6 integers each, ranging from $0$ to $359$ — stickers for first and second dice correspondingly. All integers in these lines should be unique.

Following lines should only contain either 1 or 2 — number of the dice to roll.

Don’t forget to flush the standard output after printing each line.

Input

Input consists of quadruples of lines:

  1. $x, y$ — coordinates of the center of the piece;
  2. $v_x, v_y$ ($v_x^2 + v_y^2 = 10$) — arrow direction of the piece;
  3. $d$ — amount of degrees shown on the dice (each side of the dice is shown with the same probability);
  4. Yes — the piece has covered $(0, 0)$ point, No — otherwise.

Examples

Input 1

10.000000000 -10.000000000
0.000000000 -10.000000000
180
No
10.000000000 0.000000000
0.000000000 10.000000000
90
Yes

Output 1

180 96 250 187 319 6
295 152 82 90 32 334
1
2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.