Joppiesaus Jailbreak

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

요약
각 레벨 길이와 최대 프레임 레이트가 주어질 때, 전체 프레임 수가 최소가 되도록 프레임 레이트를 정하고 그때의 시간을 출력한다.
난이도

보통10점 중 7점

유형
수학, 이분 탐색, 정수론
정답자
아직 제출이 없습니다

문제

You have recently decided to pick up speedrunning the video game Bario:\ A Plumber's Cousin. In this 2D platforming console classic, you play as Bario, an Italian electrician travelling the world to find his long lost cousin. The game consists of a number of side-scrolling levels with a bus at the end that takes Bario to the next level. Unfortunately, years of optimizations have led to a world record that is currently tied between hundreds of speedrunners and you feel like matching the world record at this point is no longer that big of an achievement. Instead, you try to beat the tied world record by any means necessary.

At first, this seems impossible: Bario has a maximum right speed of 10001000 pixels per second, and the current strategies already hold this speed through the entire level. However, completing a level always takes an integer number of frames. If Bario reaches the bus halfway through a frame, the game still has to wait for the frame to complete before starting the next level. Normally, this does not influence speedrunning, as each console runs the game at the same, constant frame rate ff. That is, unless you apply a specific condiment mix to the game disk. You would prefer not to go into detail as to how you know this, but applying a specific mix of mayonnaise and curry spices (more commonly known as the Dutch specialty Joppiesaus) to the game disk allows you to set the frame rate of the game to any positive real number. This new frame rate cannot exceed the original frame rate ff and remains constant for the entire game. Using your new strategy, what is the fastest time in which you can finish the game? The timing stops when the final frame ends.

For example, consider the third sample input. By modifying the game to run at 30001249\frac{3000}{1249} frames per second, both levels complete in 1515 frames, or 6.2456.245 seconds. The total time of 12.4912.49 seconds beats the current world record of 12.612.6 seconds at the original 1010 frames per second.

입력

The input consists of:

  • One line with two integers nn and ff (1≤n≤1051 \leq n \leq 10^5, 1≤f≤1031 \leq f \leq 10^3), the number of levels and the original frame rate of the game in frames per second.
  • One line with nn integers ℓ\ell (1≤ℓ≤1061 \leq \ell \leq 10^6), the length of each level in pixels. The total length of all levels does not exceed 10610^6 pixels.

출력

Output the fastest time, in seconds, in which you can finish the game.

Your answer should have an absolute or relative error of at most 10−610^{-6}.

예제5

  1. 예제 1

    입력
    1 10
    1234
    
    예상 출력
    1.234
    
  2. 예제 2

    입력
    1 10
    12
    
    예상 출력
    0.1
    
  3. 예제 3

    입력
    2 10
    6245 6212
    
    예상 출력
    12.49
    
  4. 예제 4

    입력
    2 20
    6245 6212
    
    예상 출력
    12.47409677
    
  5. 예제 5

    입력
    3 50
    7146 2657 8164
    
    예상 출력
    17.96910941