#P5859. 「SWTR-3」Plane Mirrors
「SWTR-3」Plane Mirrors
Description
Student dreams that he is standing on a platform. Around him there are some plane mirrors, and we assume his position is .
He finds that each plane mirror has an initial opacity, denoted by .
In what follows, we define:
-
The “opacity” of a ray as: the sum of the initial opacities of all plane mirrors that the ray passes through.
-
The “visual opacity” of a plane mirror as: the maximum opacity among all rays that originate from and pass through that plane mirror.
Student suddenly discovers that he can control these plane mirrors, so the following problem arises.
Student needs you to perform the following operations:
1 x1 y1 x2 y2 v: Create a plane mirror whose two endpoints are at , with initial opacity .
2 d: Destroy the -th created plane mirror. It is guaranteed that it has not been destroyed.
3 x y: Let . Query the opacity of the ray .
4 d: Query the visual opacity of the -th plane mirror. If it has been destroyed, output oops!.
Input Format
The first line contains an integer , denoting the number of operations.
The next lines: the -th line starts with an integer , and then:
-
If , five integers .
-
If , two integers .
-
Otherwise, one integer .
Output Format
For each query of type or , output one line with the answer.
11
1 -1 2 2 -1 7
1 2 2 -1 0 10
1 2 1 1 -1 17
3 5 4
3 -99999 0
3 -3 6
3 1 -1
4 2
2 1
4 2
4 1
7
10
17
17
17
10
oops!
Hint
Sample Explanation

As shown in the figure, blue represents rays and red represents plane mirrors.
For the 1st query: we can see the ray only passes through plane mirror , so the answer is .
For the 2nd query: we can see the ray only passes through plane mirror , so the answer is .
For the 3rd query: we can see the ray passes through plane mirrors , so the answer is .
For the 4th query: we can see the ray passes through plane mirror , so the answer is .
For the 5th query: we can see that among rays passing through plane mirror , the ray with the maximum opacity is (the ray is not unique). It passes through plane mirrors , so the answer is .
For the 6th query: we can see that among rays passing through plane mirror , the ray with the maximum opacity is (the ray is not unique). It passes through plane mirror , so the answer is .
For the 7th query: since plane mirror has been destroyed, output oops!.
Constraints and Notes
| Test point ID | Special property | |
|---|---|---|
| $ | ||
| all are equal | ||
| none |
For of the testdata, , , and .
It is guaranteed that the total number of plane mirrors will not exceed .
It is guaranteed that no plane mirror passes through , but it is not guaranteed that a plane mirror will not degenerate into a point.
It is guaranteed that for all type queries, .
For all test points, the time limit is and the memory limit is .
Translated by ChatGPT 5
京公网安备 11011102002149号