#P7719. 「EZEC-10」多彩的线段
「EZEC-10」多彩的线段
Problem Description
Muxii has a number line and line segments in different colors.
Muxii specifies that for the -th color, only the interval on the number line is allowed to be covered by segments of this color, and the length of each segment must not exceed . There can be any number of segments.
Now Muxii will ask you queries. Each query gives two numbers and . Please answer: to cover the interval on the number line, what is the minimum number of segments needed.
It is guaranteed that there is no position on the number line that cannot be covered by any segment.
Input Format
Some testdata in this problem enforces online queries.
The first line contains four integers , , , . When , this testdata enforces online queries, i.e., the real and are obtained by XOR-ing the given and with the answer to the previous query. For the first query, you may assume the previous answer is . When , this testdata does not enforce online queries.
The next lines each contain three integers , , .
The next lines each contain two integers , . The meanings of all variables not explained here have already been given in the description.
Output Format
Output lines, each containing one integer representing the answer.
0 7 2 1
1 5 3
4 7 2
1 7
3
Hint
[Sample Explanation]
At least segments are needed. One feasible solution is:
The st segment is , color ;
The nd segment is , color ;
The rd segment is , color .
[Constraints and Notes]
- Subtask 1 (5 points): , no online requirement.
- Subtask 2 (20 points): . No online requirement.
- Subtask 3 (20 points): . No online requirement.
- Subtask 4 (10 points): . No online requirement.
- Subtask 5 (25 points): no special limits, no online requirement.
- Subtask 6 (20 points): no special limits, online required.
For of the data, it is guaranteed that , , , , , . All variables above are integers.
Translated by ChatGPT 5