아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Jagged Skyline

시간 제한4초메모리 제한1024 MB

요약
각 열이 아래에서부터 건물 픽셀이 쌓인 형태인 w×h 스카이라인에서, 최대 12,000번의 질의로 가장 높은 건물의 위치와 높이를 찾는다.
난이도

보통10점 중 6점

유형
이분 탐색, 분할 정복, 구간, 구현
정답자
아직 제출이 없습니다

문제

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 (1≤w≤10,0001 \leq w\leq 10\\,000, 1≤h≤10181\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 12,00012\\,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

  1. 예제 1

    입력
    10 6
    
    sky
    
    building
    
    sky
    
    building
    
    예상 출력
    
    ? 1 1
    
    ? 3 5
    
    ? 7 3
    
    ? 9 2
    
    ! 3 5