TPS
Time limit1sMemory limit1024 MB
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 . At the start, the protagonist is at . The camera is always on the circle of radius centered at the protagonist, and it starts at . 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
Wmoves both the protagonist and the camera forward by , where forward is the direction the camera faces. - Pressing
Amoves both the protagonist and the camera left by , taking the camera's facing direction as forward. - Pressing
Smoves both the protagonist and the camera backward by , taking the camera's facing direction as forward. - Pressing
Dmoves both the protagonist and the camera right by , taking the camera's facing direction as forward. - Moving the mouse to the right rotates the camera clockwise around the protagonist on the circle of radius .
- Moving the mouse to the left rotates the camera counterclockwise around the protagonist on the circle of radius .
Input
The first line contains an integer . From the second line onward, the 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 lines, print the protagonist's coordinates and the camera's coordinates after the -th input (), as separated by spaces.