Jagged Skyline
시간 제한4초메모리 제한1024 MB
각 열이 아래에서부터 건물 픽셀이 쌓인 형태인 w×h 스카이라인에서, 최대 12,000번의 질의로 가장 높은 건물의 위치와 높이를 찾는다.
문제
The future is here! The Boxes And Parcels Centre has decided to start delivering parcels using drones. Being a BrAinPort Company, naturally the first deliveries will be to Eindhoven.
To keep the flight logic simple, the first prototype will only deliver to the roofs of the tallest buildings. After take-off, the drone will take a (, ) photo of the skyline, as shown in Figure J.1. You have been tasked with the problem of determining the location and height of the tallest building in this photo, so that the drone knows where to go.
You have access to a classifier that can determine for each pixel whether it is "sky" or "building". You can use this multiple times for different pixels. To avoid unnecessary delays, you may run the classifier at most times.
It is guaranteed that the buildings will not contain any hovering parts: whenever a pixel that is not on the bottom row of the photo is classified as building, the pixels below it will also be classified as building.

Figure J.1: The skyline of the sample interaction.