#P9807. [POI 2022/2023 R1] wyp
[POI 2022/2023 R1] wyp
Background
This problem is translated from POI2022~2023R1 wyp。
Problem Description
You are driving your newly bought car on a highway. The highway has lanes (left and right). Initially, all vehicles are in the right lane. There are cars in front of you, but they are too slow, so you want to overtake them.
Your speed is , and the speed of the -th other car is (it is guaranteed that ). If the front of your car is about to crash into another car, you will steer left to overtake. If, at your current position, there is a gap on the right lane that allows your car to move into it, then you will definitely move to the right.
Note that collisions between other cars may happen. After a collision, the speed of the car behind will change to be the same as the speed of the car in front of it.
Determine how many times your car will make a left-turn operation.
Input Format
The first line contains four integers , , , (, , ), representing the number of trucks, the length of your car, your car’s speed , and it is assumed that the coordinate of the front of your car is .
The next lines each contain four integers , , , (, ), representing the position, length, and speed of the other cars.
It is guaranteed that the input is given in increasing order of .
Output Format
Output the number of left turns needed to overtake cars.
3 1 1 1
3 2 1 4
6 3 1 2
10 2 1 4
2
Hint
Explanation of the sample:

The subtasks are as follows:
| Subtask ID | Special Property | Score |
|---|---|---|
| No additional constraints |
In this problem, subtask is the sample.
Translated by ChatGPT 5