Game with dices

시간 제한2초메모리 제한1024 MB

요약
두 주사위에 0도부터 359도까지 서로 다른 눈금 12개를 붙이고, 매 턴 굴릴 주사위를 골라 원판이 정확히 원점을 덮도록 만든다.
난이도

어려움10점 중 8점

유형
수학, 기하, 그리디, 시뮬레이션
정답자
아직 제출이 없습니다

문제

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.

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

Before starting to play one should mark a point on a table, then place round piece on the table, then choose 1212 different stickers, and 66 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 1010.

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

2≤max⁡(∣x∣,∣y∣)≤5002 \leq \max(|x|, |y|) \leq 500

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

입력

Input consists of quadruples of lines:

  1. xx, yy --- coordinates of the center of the piece;
  2. v_xv\_x, v_yv\_y (v_x2+v_y2=10v\_x^2 + v\_y^2 = 10) --- arrow direction of the piece;
  3. dd --- 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)(0, 0) point, <<No>> --- otherwise.

출력

First two lines of the output should contain 66 integers each, ranging from 00 to 359359 --- stickers for first and second dice correspondingly. All integers in these lines should be unique.

Following lines should only contain either 11 or 22 --- number of the dice to roll.

예제1

  1. 예제 1

    입력
    10.000000000 -10.000000000
    0.000000000 -10.000000000
    
    
    
    180
    No
    10.000000000 0.000000000
    0.000000000 10.000000000
    
    90
    Yes
    
    예상 출력
    
    
    180 96 250 187 319 6
    295 152 82 90 32 334
    1
    
    
    
    
    2