# Untitled

unknown
plain_text
14 days ago
2.9 kB
1
Indexable
Never
```“Long Ladder Game” is a game in which 100 players participate and follow each path down the long ladder.

Each player has an ID number from 1 to 100.
The game is played on a map, which is in the form of a two-dimensional plane, as in [Fig. 1].

All vertical lines are drawn on the initial map. Vertical lines are NOT deleted.

There are NO horizontal lines on the initial map. Horizontal lines can be added and deleted at any time.

When the game starts, Player mID moves under the rules below.

1) Start from (mID, 0).

2) Until there is a point where a horizontal and vertical lines intersect, the player moves along the vertical line in the direction where the value of y-coordinate increases. If a horizontal and vertical lines do NOT intersect, the player keeps moving until the value of y-coordinate reaches 1,000,000,000.

3) When the player arrives at an intersection of a horizontal and vertical lines, he/she moves to the opposite end of the horizontal line.

4) Repeat step 2) and 3) until the value of y-coordinate reaches 1,000,000,000.​

When the game is played on the map as in [Fig. 1], Player 5 passes through (5, 7).The following is the description of API to be written in the User Code.

void init()

This function is called in the beginning of each test case.

At the start of the test case, all vertical lines are drawn on the map.

At the start of the test case, there are NO horizontal lines on the map.

This function guarantees that there is NO horizontal line whose y-coordinate is mY.

This function adds a horizontal line that connects (mX, mY) to (mX+1, mY).

Parameters

mX : X-coordinate (1 ≤ mX ≤ 99)

mY : Y-coordinate (1 ≤ mY ≤ 999,999,999)

void remove(int mX, int mY)

This function guarantees that there is a horizontal line connecting (mX, mY) to (mX+1, mY).

This function removes the horizontal line connecting (mX, mY) to (mX+1, mY).

Parameters

​mX : X-coordinate (1 ≤ mX ≤ 99)

​mY : Y-coordinate (1 ≤ mY ≤ 999,999,999)

int numberOfCross(int mID)

When playing the game on the current map, this function returns the number of horizontal lines Player mID passes through.

Player mID starts moving from (mID, 0).

Parameters

mID : Player No. (1 ≤ mID ≤ 100)

Returns

​The number of horizontal lines Player mID passes through

int participant(int mX, int mY)

When playing the game on the current map, this function returns the Player No. passing through (mX, mY).

It is guaranteed that (mX, mY) is NOT the point of intersection of a horizontal and vertical lines.

There is always one player who passes through (mX, mY).

Parameters

mX : X-coordinate (1 ≤ mX ≤ 100)

​mY : Y-coordinate (1 ≤ mY ≤ 1,000,000,000)

Returns

The Player No. passing through (mX, mY)```