Display of Springs
시간 제한2초메모리 제한512 MB
n개의 용수철에 대해 h_i - w/k_i 형태의 숨은 직선이 주어질 때, 비교 측정만으로 주어진 w에서 가장 낮은 값을 갖는 용수철을 찾는다.
문제
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 elastic springs in a line attached to the ceiling. Spring is attached at height and has a stiffness constant . If we attach a weight of mass to the lower end of the -th spring, the weight will descend to a height given by the formula:
Elater will take questions from people in the audience. When asked about a positive integer , Elater will be able to pick the spring which, if a weight of mass 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 and , but he can choose two springs and and a mass , try attaching a weight of mass 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 such measurements. Also, after each question, Elater can distract the audience for a while, so that Hooke can do up to 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.