Ivan's disqualification (1) P69990


pdf   zip


Ivan is participating in the ACM-ICPC World Finals in Ekaterinburg. As usual, Ivan is trolling, so he is going to be disqualified. However, the guys of the organization must first reach him. Ivan is trying to escape in the spectators zone, which for simplicity we consider a circumference. Ivan is located at an angle of α degrees with respect to the center of the circunference, while the n guys are located at angles α1, …, αn. Ivan has a maximum angular speed of i degrees per second, while the n guys have all a maximum angular speed g.

How many second will it take any of the guys of the organization to reach Ivan? Suppose that Ivan tries to maximize this time, while the guys coordinate to try to minimize it. At every moment, everyone can move in any direction (left or right), but never exceding his maximum speed. When calculating, treat averybody as a point.


Input consists of several cases, each with i, g, α, n, α1, …, αn. All numbers are integers. The speeds are between 1 and 1000, the angles between 0 and 359, and n between 1 and 1000.


For every case, print the time of Ivan’s disqualification with four digits after the decimal point. Print “never” if this will never happen.

Public test cases
  • Input

    3 4 180 1 90
    4 3 180 1 90
    100 3 270 5 240 0 359 120 359


  • Information
    Salvador Roura
    Official solutions
    User solutions