13914 - Soccer (1/3)   

Description

Katex

You are going to broadcast a football game.

The field of this game is length of \(n\), width of \(m\), and there are \(p\) players who's ready to joint this game.

During the game, there would be some events which you need to handle.

Type 1: A player numbered \(player_id\) has catched the ball.

Type 2: The player who's having the ball has kicked it along the direction of (\(dx\), \(dy\)). The ball would stop moving if it has hit the boundary of this field (\(x = 0\), \(x = n-1\), \(y = 0\), \(y = m-1\)), or any player on its way, except the players who was standing at its initial position.

Type 3: The player who's having the ball has kicked it along the direction of (\(dx\), \(dy\)). The ball would stop moving if it has hit any player on its way, except the players who was standing at its initial position. Even if the ball has hit the boundary of the field, it'll keep moing until it cannot move in each direction. (Check the figure below for better understanding)

Type 4: The player who's having the ball has kicked it along the direction of (\(dx\), \(dy\)). The ball would stop moving if it has hit any player on its way, except the players who was standing at its initial position. If the ball has hit the boundary of the field, it'll rebound once and then follow the mechanism as ball in Type 3. (Check the figure below for better understanding)

Type 5: You have to report the current state of this game.

In the example of type 3 above, the following events have happened. 1. The ball has hit the boundary of x = n-1, dx becomes 0. 2. The ball has hit the boundary of y = 0, dy becomes 0. 3. dx = 0 and dy = 0, the ball had stop moving.

In the example of type 4 above, the following events have happened. 1. The ball has hit the boundary of x = n-1, dx *= -1. 2. The ball has hit the boundary of y = 0, dy becomes 0. 3. The ball is flying along its direction...

In this problem, event except type 2, 3, 4 has been implemented for you. You have to implement the function handleBallKicked for type 2, 3, function handleBallKickedRebounce for type 4.

Input

Katex The first line of input contains \(3\) integers \(n\), \(m\), \(p\). The second line of input contains \(2\) integers \(bx\), \(by\), denote the position of the ball. The \(3 \sim 2+p\) lines, each contains \(2\) integers \(x\), \(y\), which denotes the position the player. The \(p+3\) line contains a single integer \(rounds\), which denotes the number of rounds of this game. The \(p+4 \sim p+3+rounds\) lines, each contains a event. An event may be one of the following types, described above.:
    \(1\) \(player_id\)
    \(2\) \(dx\) \(dy\)
    \(3\) \(dx\) \(dy\)
    \(4\) \(dx\) \(dy\)
    \(5\)

Constraints

    \(2 \le n, m \le 100\)
    \(1 \le p \le 20\)
    \(0 \le bx, x \le n-1\)
    \(0 \le by, y \le m-1\)
    \(-1 \le dx, dy \le 1\)
    For each query of type 2, either \(dx = 0\) or \(dy = 0\)
    For each query of type 3, either \(dx != 0\) or \(dy != 0\)
    For each query of type 4, either \(dx != 0\) or \(dy != 0\)

Output

Katex For each query of type 5, output the player who's holding the ball, and the ball's current position. (Please check the sample output for better understanding).

Sample Input  Download

Sample Output  Download

Partial Judge Code

13914.cpp

Partial Judge Header

13914.h

Tags




Discuss