Under construction

Still being built. Things may change

TPS

Time limit1sMemory limit1024 MB

Summary
Simulate W, A, S, D moves and 90-degree camera rotations around the protagonist, printing both positions after each input.
Level

Easy2 of 10

Topics
Simulation, Implementation
Solved
No attempts yet

Problem

TPS (third-person shooter) is a game played from a third-person camera that watches the protagonist, not from the protagonist's own first-person view. Because the player moves a free camera, the game can be enjoyed from many angles. This problem simulates such a TPS game and finds how the positions of the protagonist and the camera change with each input.

Protagonist and camera

The protagonist and the camera are on a 2D coordinate plane, and their positions are integer coordinates (x,y)(x,y). At the start, the protagonist is at (0,0)(0,0). The camera is always on the circle of radius 11 centered at the protagonist, and it starts at (0,−1)(0,-1). The camera always faces the protagonist.

Each time the player presses a key or moves the mouse, the protagonist, the camera, or both change position as follows. After each move, the protagonist and the camera are still at integer coordinates.

  • Pressing W moves both the protagonist and the camera forward by 11, where forward is the direction the camera faces.
  • Pressing A moves both the protagonist and the camera left by 11, taking the camera's facing direction as forward.
  • Pressing S moves both the protagonist and the camera backward by 11, taking the camera's facing direction as forward.
  • Pressing D moves both the protagonist and the camera right by 11, taking the camera's facing direction as forward.
  • Moving the mouse to the right rotates the camera 90∘90^{\circ} clockwise around the protagonist on the circle of radius 11.
  • Moving the mouse to the left rotates the camera 90∘90^{\circ} counterclockwise around the protagonist on the circle of radius 11.

Input

The first line contains an integer N(1≤N≤100)N(1\le N\le 100). From the second line onward, the NN player inputs are given in the order they were entered. Each input is one of W, A, S, D, MR, or ML. W, A, S, and D mean the corresponding keyboard key was pressed, MR means the mouse was moved to the right, and ML means the mouse was moved to the left.

Output

On each of NN lines, print the protagonist's coordinates (x_p,y_p)(x\_p,y\_p) and the camera's coordinates (x_c,y_c)(x\_c,y\_c) after the ii-th input (1≤i≤N1\le i\le N), as x_p,y_p,x_c,y_cx\_p,y\_p,x\_c,y\_c separated by spaces.

Examples2

  1. Example 1

    Input
    3
    MR
    W
    D
    
    Expected output
    0 0 -1 0
    1 0 0 0
    1 -1 0 -1
    
  2. Example 2

    Input
    6
    W
    D
    ML
    S
    MR
    A
    
    Expected output
    0 1 0 0
    1 1 1 0
    1 1 2 1
    2 1 3 1
    2 1 2 0
    1 1 1 0