CF1028F.Make Symmetrical

省选/NOI-

通过率:0%

时间限制:6.00s

内存限制:512MB

AC君温馨提醒

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

题目描述

Consider a set of points AA, initially it is empty. There are three types of queries:

  1. Insert a point (xi,yi)(x_i, y_i) to AA. It is guaranteed that this point does not belong to AA at this moment.
  2. Remove a point (xi,yi)(x_i, y_i) from AA. It is guaranteed that this point belongs to AA at this moment.
  3. Given a point (xi,yi)(x_i, y_i), calculate the minimum number of points required to add to AA to make AA symmetrical with respect to the line containing points (0,0)(0, 0) and (xi,yi)(x_i, y_i). Note that these points are not actually added to AA, i.e. these queries are independent from each other.

考虑一个点集 AA,初始时为空。存在三种类型的查询:

  1. 向 AA 中插入一个点 (xi,yi)(x_i, y_i)。保证该点此时不在 AA 中。
  2. 从 AA 中删除一个点 (xi,yi)(x_i, y_i)。保证该点此时属于 AA。
  3. 给定一个点 (xi,yi)(x_i, y_i),计算为使 AA 关于过点 (0,0)(0, 0) 和 (xi,yi)(x_i, y_i) 的直线对称,所需向 AA 中添加的最少点数。注意:这些点实际上不会被加入 AA,即此类查询相互独立。

输入格式

The first line contains a single integer qq (1≤q≤2⋅1051 \le q \le 2 \cdot 10^5) — the number of queries.

Each of the following qq lines describes a query and contains three integers tit_i, xix_i and yiy_i ($ t_i \in {1, 2, 3}$, 1≤xi,yi≤112 9041 \le x_i, y_i \le 112\,904) — the type of the query and the coordinates of the point. Type 11 is addition of the point, type 22 is removal of the point, type 33 is the query to compute the minimum number of points required to make AA symmetrical.

It is guaranteed that there are no more than 10510^5 queries of type 33 and no more than 10510^5 queries having type 11 or 22.

第一行包含一个整数 qq(1≤q≤2⋅1051 \le q \le 2 \cdot 10^5),表示查询次数。

接下来的 qq 行每行描述一次查询,包含三个整数 tit_i、xix_i 和 yiy_i(其中 ti∈{1,2,3}t_i \in \{1, 2, 3\},1≤xi,yi≤112 9041 \le x_i, y_i \le 112\,904),分别表示查询类型及该点的坐标。类型 11 表示添加该点;类型 22 表示删除该点;类型 33 表示查询:为使集合 AA 成为中心对称,至少需要添加多少个点。

保证类型 33 的查询总数不超过 10510^5,且类型 11 或类型 22 的查询总数也不超过 10510^5。

输出格式

For each query of the third type output a line with a single integer — the answer to this query.

对于每个第三种类型的查询,输出一行,包含一个整数——该查询的答案。

输入输出样例

  • 输入#1

    12
    1 1 6
    1 6 1
    1 5 5
    1 2 3
    3 4 4
    1 3 2
    3 7 7
    2 2 3
    2 6 1
    3 8 8
    2 5 5
    3 1 1

    输出#1

    1
    0
    2
    2
  • 输入#2

    6
    1 1 2
    3 1 1
    1 1 1
    3 2 2
    2 1 1
    3 2 4

    输出#2

    1
    1
    0

说明/提示

The first example is shown on the picture below.

第一个示例见下图。

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

首页