CF856E.Satellites

NOI/NOI+/CTSC

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

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:

真实宇宙通信公司(RCC)是位于宇宙最边缘一颗遥远星球上的最大电信公司,负责发射通信卫星。

该星球位于宇宙的最边缘,因此其形状为一个半圆,半径为 rr,其直径的两个端点分别为 AA 和 BB。直线 ABAB 即为宇宙的边界,因此其中一个半平面内空无一物——既没有星球本身,也没有 RCC 的卫星,更无其他任何物体。我们建立如下坐标系:坐标原点位于线段 ABAB 的中点,OXOX 轴与直线 ABAB 重合,整个星球完全位于 y>0y > 0 的上半平面内。

卫星可位于宇宙中除星球表面以外的任意位置;但卫星绝不会位于宇宙边界之外,也绝不会恰好落在边界 ABAB 上——即所有卫星的纵坐标均满足 y>0y > 0。卫星天线朝向如此设定:以卫星自身为顶点张开一个角,该角的两条边分别指向点 AA 和点 BB。我们将该区域称为卫星覆盖区域。

下图展示了该坐标系及一颗卫星的覆盖区域:

RCC 成立之初,星球周围尚无任何卫星。此后,陆续发生若干事件,每起事件属于以下三类之一:

  1. 1 x y —— 发射一颗新卫星,并将其置于点 (x,y)(x, y) 处。卫星一经发射即固定不动,始终保持在初始部署位置。我们将按发射顺序对卫星编号,从 11 开始,第 ii 颗发射的卫星编号为 ii。
  2. 2 i —— 移除编号为 ii 的卫星。
  3. 3 i j —— 尝试在编号为 ii 和 jj 的两颗卫星之间建立通信信道。为此需部署一个中继器。该中继器不得位于星球内部,但可位于星球的半圆形边界上或其上方。中继器必须同时处于卫星 ii 和卫星 jj 的覆盖区域内;为避免信号干扰,它不得处于任何其他卫星的覆盖区域内。当然,中继器必须位于宇宙之内,即其纵坐标必须满足 y>0y > 0。

对于每一次建立通信信道的尝试(即每个类型 3 的事件),你都需要判断该操作是否可行。

样例测试中的卫星位置如下所示:

输入格式

The first line of input data contains integers r and n — radius of the planet and the number of events (1 ≤ r ≤ 109, 1 ≤ n ≤ 5·105).

Each of the following n lines describe events in the specified format.

Satellite coordinates are integer, the satisfy the following constraints |x| ≤ 109, 0 < y ≤ 109. 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.

输入数据的第一行包含两个整数 rr 和 nn —— 分别表示行星的半径和事件总数(1≤r≤1091 \leq r \leq 10^9,1≤n≤5⋅1051 \leq n \leq 5 \cdot 10^5)。

接下来的 nn 行按指定格式描述各个事件。

卫星坐标为整数,满足约束条件 ∣x∣≤109|x| \leq 10^9,0<y≤1090 < y \leq 10^9。任意时刻同时存在的两颗卫星不会占据同一位置。每颗卫星到行星中心的距离严格大于 rr。

保证类型为 2 和 3 的事件所引用的卫星在该时刻均存在。对于所有类型为 3 的事件,均满足不等式 i≠ji \neq j。

输出格式

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.

对于每个类型为 3 的事件,如果能够建立通信信道,则在单独一行输出 «YES»;否则(即无法建立通信信道)输出 «NO»。

输入输出样例

  • 输入#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

输入解题思路,AI测评打分。不知道怎么写?

首页