304494: CF856E. Satellites
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Satellites
题意翻译
### 题意 给定一个半径为r的半圆,圆心为坐标原点O,直径为AB,半圆弧位于x轴上方。给定n次操作,每次为以下3种操作之一: ①1 x y — 在(x,y)处放置一颗卫星,如果该卫星是第 i 个被放到平面上的卫星,则它的编号为i; ②2 i — 移除编号为 i 的卫星; ③3 i j — 对卫星 i 和卫星 j 进行询问,若在卫星 i 和卫星 j 的公共控制区域能够找到一个点,满足这个点不被其他卫星所控制,那么输出"YES",否则输出"NO"。 一颗卫星点P的控制区域为△PAB中的不在⊙O内的部分。如下图绿色区域: ![](https://images2017.cnblogs.com/blog/1145365/201709/1145365-20170915135059172-1768812089.png) ### 输入格式 第一行两个整数r,n。接下来n行,每行表示一个操作。 ### 输出格式 对于每个操作3,输出"YES"或“NO”。题目描述
Real Cosmic Communications is the largest telecommunication company on a far far away planet, located at the very edge of the universe. RCC launches communication satellites. The planet is at the very edge of the universe, so its form is half of a circle. Its radius is $ r $ , the ends of its diameter are points $ A $ and $ B $ . The line $ AB $ is the edge of the universe, so one of the half-planes contains nothing, neither the planet, nor RCC satellites, nor anything else. Let us introduce coordinates in the following way: the origin is at the center of $ AB $ segment, $ OX $ axis coincides with line $ AB $ , the planet is completely in $ y>0 $ half-plane. The satellite can be in any point of the universe, except the planet points. Satellites are never located beyond the edge of the universe, nor on the edge itself — that is, they have coordinate $ y>0 $ . Satellite antennas are directed in such way that they cover the angle with the vertex in the satellite, and edges directed to points $ A $ and $ B $ . Let us call this area the satellite coverage area. The picture below shows coordinate system and coverage area of a satellite. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF856E/222184e7095fd2581c95f147bcfd9992c0d0bcdd.png)When RCC was founded there were no satellites around the planet. Since then there have been several events of one of the following types: 1. 1 x y — launch the new satellite and put it to the point $ (x,y) $ . Satellites never move and stay at the point they were launched. Let us assign the number $ i $ to the $ i $ -th satellite in order of launching, starting from one. 2. 2 i — remove satellite number $ i $ . 3. 3 i j — make an attempt to create a communication channel between satellites $ i $ and $ j $ . To create a communication channel a repeater is required. It must not be located inside the planet, but can be located at its half-circle border, or above it. Repeater must be in coverage area of both satellites $ i $ and $ j $ . To avoid signal interference, it must not be located in coverage area of any other satellite. Of course, the repeater must be within the universe, it must have a coordinate $ y>0 $ . For each attempt to create a communication channel you must find out whether it is possible. Sample test has the following satellites locations: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF856E/24371c566f849d11eeef9ad0551b1837ee398891.png)输入输出格式
输入格式
The first line of input data contains integers $ r $ and $ n $ — radius of the planet and the number of events ( $ 1<=r<=10^{9} $ , $ 1<=n<=5·10^{5} $ ). Each of the following $ n $ lines describe events in the specified format. Satellite coordinates are integer, the satisfy the following constraints $ |x|<=10^{9} $ , $ 0<y<=10^{9} $ . No two satellites that simultaneously exist can occupy the same point. Distance from each satellite to the center of the planet is strictly greater than $ r $ . It is guaranteed that events of types $ 2 $ and $ 3 $ only refer to satellites that exist at the moment. For all events of type $ 3 $ the inequality $ i≠j $ is satisfied.
输出格式
For each event of type $ 3 $ print «YES» on a separate line, if it is possible to create a communication channel, or «NO» if it is impossible.
输入输出样例
输入样例 #1
5 8
1 -5 8
1 -4 8
1 -3 8
1 2 7
3 1 3
2 2
3 1 3
3 3 4
输出样例 #1
NO
YES
YES