Jagged Skyline
문제
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.
예제
예제 1
10 6 sky building sky building
? 1 1 ? 3 5 ? 7 3 ? 9 2 ! 3 5