13895 - Football Game   

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 holding 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: You have to report the current state of this game.

In this problem, event except type 2 has been implemented for you.

To fulfill the requirements, you should also implement the functions GetWho(), which returns the player id of the one that is holding the ball right now, or -1 if no player is holding the ball.

Next, you should implement the function SomeoneIsHere(), which returns if there's any player standing at a specific position

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\)

Constraints

    \(1 \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\)

Output

Katex For each query of type 3, 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

13895.cpp

Partial Judge Header

13895.h

Tags




Discuss