#P8473. [Aya Round 1 H] 破碎的历史
[Aya Round 1 H] 破碎的历史
Background
Gensokyo has met its destruction, and the carrier of fantasy has already faded into fantasy.
Fortunately, the residents of Gensokyo have survived by chance, and they are trying to restore Gensokyo’s history. However, there are countless big and small events in history, and people can only remember some major events.
Perhaps, based on those important events, the minor events can be deduced?
Problem Description
On the positive half-axis of the number line, there are distinct special integer points colored black or white, with positions from left to right being . Maintain a multiset of segments , initially empty.
There are operations. There are several types of operations, in the following formats:
1 l r: Add to all segments such that and both endpoints are special integer points.2 x: Revoke the segments added by the -th operation.
Initially and after each operation, assume you may perform any number (possibly zero) of coloring actions. Each time, choose a segment from such that the special integer points at and are both black, then color all white special integer points inside this segment to black. Determine whether there exists at least one valid coloring method that makes all special integer points on the positive half-axis black (i.e., no white special integer points remain). Note: all queries are “hypothetical”, meaning different queries are independent and will not cause any actual modification to the number line.
Input Format
- The first line contains two integers .
- The second line contains integers , representing the positions of the special integer points from left to right.
- The third line contains integers , representing the colors of the special integer points. Here means white, and means black.
- The next lines each contain two or three integers, describing one operation.
Output Format
- Output a total of lines.
- Initially and after each operation, output one line with one string:
yesmeans there exists a valid coloring method.nomeans there does not exist a valid coloring method.
- You may output the strings in any letter case. For example,
yes,Yes, andYESare all accepted as indicating that a valid coloring method exists.
6 3
1 2 3 5 8 13
1 0 0 1 0 1
1 5 10
1 1 15
2 2
No
No
Yes
No
Hint
Sample Explanation
The positions/colors of the six special points on the positive half-axis are shown in the figure.

It is easy to see that not all points are black. Therefore, before any operation, output .
After the first operation, three segments are added to in total: (segments with overlapping endpoints are omitted in the figure). It is easy to see that no action can be performed at this time, so it is impossible to make all points black. Output .

After the second operation, another segments are added into . After removing segments with overlapping endpoints, is shown in the figure. (To distinguish them, the edges added in the previous operation are marked in dark blue.)

One can find a plan to turn all special points in the figure black. Specifically, first choose the segment in (it is easy to see that the special points at and are both black, so coloring is allowed), then the points at and can be colored.

Now you can choose the segment in (in the previous step, point became black, so satisfies the condition) and color point black.

Now all points are black, so output . Again, the queries are independent of each other, and this only asks whether a coloring plan exists; it will not actually color the special integer points.

The third operation revokes all segments added into by the second operation. Therefore, it returns to the state where only the first operation exists. There is no plan that can color all points black, so output .
Constraints
For all testdata, , , , . It is guaranteed that is strictly increasing, operation type only revokes operation type , and each operation is revoked at most once.
Translated by ChatGPT 5