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

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

Display of Springs

시간 제한2초메모리 제한512 MB

요약
n개의 용수철에 대해 h_i - w/k_i 형태의 숨은 직선이 주어질 때, 비교 측정만으로 주어진 w에서 가장 낮은 값을 갖는 용수철을 찾는다.
난이도

보통10점 중 7점

유형
기하, 정렬, 이분 탐색
정답자
아직 제출이 없습니다

문제

Elater is a great magician. His most famous show is "Elater's Super Spectacular Display of Springs". The show consists in the following:

There are nn elastic springs in a line attached to the ceiling. Spring ii is attached at height h_ih\_i and has a stiffness constant k_ik\_i. If we attach a weight of mass ww to the lower end of the ii-th spring, the weight will descend to a height HH given by the formula:

H=h_i−wk_i.H = h\_i - \frac{w}{k\_i}\text{.}

Elater will take questions from people in the audience. When asked about a positive integer ww, Elater will be able to pick the spring which, if a weight of mass ww is attached to its lower end, will descend to a height lower (closer to the floor) than all the other springs (in case of a tie, he will be able to pick one of the springs with the lowest descend height). To accomplish such an amazing feat, Elater has the help of his dear assistant, Hooke.

Before the show, Hooke has some time to do measurements on the springs. He can not directly measure the values of h_ih\_i and k_ik\_i, but he can choose two springs aa and bb and a mass ww, try attaching a weight of mass ww to the two springs, and see which of them goes closer to the floor with that weight. Before the show, he has time to do up to 20,00020\\,000 such measurements. Also, after each question, Elater can distract the audience for a while, so that Hooke can do up to 2020 more measurements before inconspicuously whispering the answer to Elater.

Can you help Hooke make the show successful? Assume that the springs are attached high enough, and the masses are small enough, so that the weights never reach the floor during any possible measurement. Also note that the weights are removed after each measurement.

예제1

  1. 예제 1

    입력
    3
    
    SECOND
    
    QUESTION 2
    
    SECOND
    
    FIRST
    
    QUESTION 6
    
    SECOND
    
    SECOND
    
    FINISH
    
    예상 출력
    
    ? 0 1 1
    
    !
    
    ? 0 1 2
    
    ? 1 2 2
    
    ! 1
    
    ? 0 1 6
    
    ? 1 2 6
    
    ! 2