(转)C - MaratonIME eats japanese food( Gym - 101375C )

版权声明:版权所有--转载的小伙伴请告知博主并注明来源哦~ https://blog.csdn.net/u011145745/article/details/81813826

C - MaratonIME eats japanese food

 Gym - 101375C 

Statements

After a long time eating japanese food, the members of MaratonIME are getting really good at it. Nowadays, a massive amount of japanese food is eaten by the group and it's often difficult to find space for all the plates in the table, since two plates can touch but never overlap. The fact that there is so much food in each plate makes this even worse, because they can't move the plates on the table until there is no more food in them.

For that reason, everytime a plate arrives, they need to try lots of different positions for that plate on the table. You need to help them by creating a program that will aid on that rampant gluttony. Your program starts off with an empty table and has to respond to various queries, each of one of two types:

  1. x y r - Place a circular plate centered at (x, y) with radius r.
  2. x y r - Remove the circular plate centered at (x, y) with radius r.

For each plate, its center position (x, y) and its radius are given in centimeters (the plate's located x centimeters away from the left border and y centimeters away form the upper border). The table always has 10 meters both in width and height and a plate is allowed to hang off the table, as long as it's center is on the table (or on its border).

For each query of type A, you must determine if it was possible to place the given plate on the given position (if that plate does not overlap any other, note that it is allowed for it to touch other plates) and place it if possible. For each query of type R, you must determine if it was possible to remove that plate on the given position from the table (if there is a plate with those coordinates and radius on that position) and remove it if possible.

Input:

On the first line of the input an integer Q ≤ 5000 is given, the amount of queries that need to be answered.

On each one of the Q following lines the queries are described. Each of them is given by a character , the type of the query, and three integers xy and r, the coordinates and radius of the plate, 0 ≤ x, y ≤ 1000 and 1 ≤ r ≤ 1000.

Output:

For each query, print a line with "Ok" (without quotes) if it is possible to perform such query (add the plate on type A and remove the plate on type R) and "No" otherwise.

Example

Input

8
A 20 25 15
A 25 25 5
A 20 55 15
A 35 40 7
A 35 40 6
R 20 25 15
A 20 25 10
R 20 25 15

Output

Ok
No
Ok
No
Ok
Ok
Ok
No

转载的同学的代码如下:

是图片,需要自行敲码,(应该是暴力)

Preparing... 1/10

猜你喜欢

转载自blog.csdn.net/u011145745/article/details/81813826