#P7188. [CRCI2008-2009] CVJETICI
[CRCI2008-2009] CVJETICI
Description
On a distant planet, a strange plant with two stems was discovered.
Each plant on the planet can be described by numbers: the coordinates of stems and , and the height at which the two stems are connected. The picture below shows a plant with , , :

Every day, new plants grow on this planet. A plant that grows on day has height , and every plant that grows on each following day is taller than the plants that grew on the previous day.
When a stem of one plant intersects the horizontal segment that connects the two stems of another plant, a small flower will grow at the intersection point (unless there is already a flower at that point). There is one exception: if the intersection forms a "T" shape, that is, when a stem of one plant overlaps with a stem of another plant, then no flower will grow at the intersection point. Some examples are shown below:

Given the coordinates of all plants, find the number of flowers that grow each day.
Input Format
The first line contains a positive integer , the number of days.
In the next lines, each line contains two integers and , the coordinates of the two stems of the plant that grows on that day.
Output Format
Output lines. Each line contains a positive integer, in order, representing the number of flowers that grow on day .
4
1 4
3 7
1 6
2 6
0
1
1
2
5
1 3
3 5
3 9
2 4
3 8
0
0
0
3
2
Hint
Constraints
For of the testdata, , .
Notes
- This problem is worth points in total.
- This problem is translated from COCI2008-2009 CRCI2008-2009 CVJETICI. The main translation was done by https://www.luogu.com.cn/user/219791
Translated by ChatGPT 5
京公网安备 11011102002149号