#P4198. 楼房重建
楼房重建
Description
Outside Xiao A’s building is a large construction site with buildings under construction. Every day, buildings on this site are torn down and rebuilt, over and over. He often stares out the window, counting how many buildings he can see.
To simplify, we consider the events in a 2D plane. Xiao A is at point . The -th building is represented by a line segment connecting and , where is the height of the -th building. A building is considered visible if there exists a point on it with height greater than such that the line segment from to that point does not intersect any of the segments of buildings .
The construction lasts for days. Initially, all buildings have height . On day , the crew sets the height of the building with -coordinate to (the height may increase — construction, decrease — demolition, or remain unchanged — meaning the crew effectively did nothing that day). After the crew finishes each day, please tell how many buildings Xiao A can see.
Input Format
The first line contains two positive integers .
The next lines each contain two positive integers .
Output Format
Output lines. On the -th line, output one integer denoting the number of buildings visible to Xiao A after day .
3 4
2 4
3 6
1 1000000000
1 1
1
1
1
2
Hint
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号