#P9571. 「NnOI R2-T3」Horizon Blue
「NnOI R2-T3」Horizon Blue
Problem Description
Little C likes drawing on a drawing board. He performs operations. Each operation can be one of the following three types:
1 k bmeans Little C draws a line with equation .2 k bmeans Little C asks you: the line has exactly one common point with how many drawn lines?3 k bmeans Little C erases all lines that have at least one common point with the line .
Note: Two overlapping (coincident) lines have infinitely many intersection points.
Note: During queries, coincident lines should be counted separately.
Input Format
The first line contains an integer .
The next lines each contain three integers , representing one operation.
Output Format
For each 2 k b operation, output the number of lines that satisfy the requirement.
6
1 1 0
1 -1 0
2 2 1
3 1 3
2 2 1
2 1 1
2
1
0
10
1 1 0
1 1 0
2 1 1
2 1 0
2 2 5
3 1 0
2 2 5
1 2 3
1 3 4
2 3 5
0
0
2
0
1
Hint
[Sample 1 Explanation]
In the 1st operation, draw the line .
In the 2nd operation, draw the line .
In the 3rd operation, you can see that the line intersects the previous two lines.
In the 4th operation, erase all lines that intersect ; the line is erased.
In the 5th operation, obviously intersects .
In the 6th operation, has the same slope as , so they are parallel and do not intersect.
[Constraints]
For of the testdata, , , .
Hint: This problem uses bundled tests.
$$\def\r{\cr\hline} \def\None{\text{None}} \def\arraystretch{1.5} \begin{array}{c|c|c} \textbf{Subtask} & \textbf{Sp. Constraints} & \textbf{Score}\r \textsf1& n \le 5000 & 27 \r \textsf2& \vert k\vert,\vert b\vert \le 50 & 21 \r \textsf3& No type 3 operations & 13 \r \textsf4& The $i$-th operation satisfies $k = i$ & 14 \r \textsf5& No special constraints & 25 \r \end{array}$$The hack test points added after the contest will be placed into subtask 6.
Source
| Item | People |
|---|---|
| idea | 船酱魔王 (Chuánjiàng Mówáng) |
| data | |
| check | EstasTonne |
| solution | 船酱魔王 (Chuánjiàng Mówáng) |
Translated by ChatGPT 5