PivotOJ

Jagged Skyline

시간 제한: 4000ms메모리 제한: 1024MB출처: BAPC 2022BOJ 26001

문제

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 w×hw\times h (1w100001 \leq w\leq 10\,000, 1h10181\leq h\leq 10^{18}) 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 1200012\,000 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
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.