luogu#P6952. [NEERC2017] Archery Tournament

[NEERC2017] Archery Tournament

题目描述

You were invited to the annual archery tournament. You are going to compete against the best archers from all of the Northern Eurasia. This year, a new type of competition is introduced, where a shooting range is dynamic and new targets might appear at any second.

As the shooting range is far enough from you, it can be represented as a 2D plane, where y=0y = 0 is the ground level. There are some targets in a shape of a circle, and all the targets are standing on the ground. That means, if a target's center is (x,y)(y>0)(x , y) (y > 0) , then its radius is equal to yy , so that it touches the line y=0y = 0 . No two targets simultaneously present at the range at any given time intersect (but they may touch).

Initially, the shooting range is empty. Your participation in this competition can be described as nn events: either a new target appears at the range, or you shoot an arrow at some point at the range. To hit a target, you must shoot strictly inside the circle (hitting the border does not count). If you shoot and hit some target, then the target is removed from the range and you are awarded one point.

输入格式

The first line of the input contains integer n(1n2105).n (1 \le n \le 2·10^{5}). Next nn lines describe the events happening at the tournament. The i-th line contains three integers ti,xi,t_{i}, x_{i}, and yi(ti=1,2y_{i} (t_{i} = 1 , 2 ; 109xi,yi109−10^{9} \le x_{i}, y_{i} \le 10^{9} ; yi>0)y_{i} > 0) .

If ti=1t_{i} = 1 , then a new target with center (xi,yi)(x_{i}, y_{i}) and radius yiy_{i} appears at the range.

If ti=2t_{i} = 2 , then you perform a shot, which hits the range at (xi,yi).(x_{i}, y_{i}).

输出格式

For each of your shots, output a separate line with the single integer. If the shot did not hit any target, print -1. If the shot hit a target, print the number of event when that target was added to the range. Events are numbered starting from 11 .

题目大意

给出一些圆,这些圆圆心在 xx 轴上方,且与 xx 轴相切,任意时刻,不存在图上的圆相交,给出两种操作:增加一个圆;向图中发送一颗子弹,如果击中某个圆,输出该圆编号并且删掉这个圆。如果未击中,则输出 -1

8
1 0 12
2 -11 22
1 24 10
1 12 3
2 12 12
2 16 14
1 28 15
2 3 6

-1
-1
3
1

提示

Time limit: 3 s, Memory limit: 512 MB.