AlgoLensArena
ContestlərProblemlərOtaqlar
Vizualizator
← Məsələlər

DAPC24-045.Joppiesaus Jailbreak

Medium · 2 s · 256 MB

  • icpc
  • dapc
  • 2024

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 100010001000 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 fff. 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 fff 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}12493000​ frames per second, both levels complete in 151515 frames, or 6.2456.2456.245 seconds. The total time of 12.4912.4912.49 seconds beats the current world record of 12.612.612.6 seconds at the original 101010 frames per second.

Giriş formatı

The input consists of:

• One line with two integers nnn and fff (1≤n≤1051 \leq n \leq 10^51≤n≤105, 1≤f≤1031 \leq f \leq 10^31≤f≤103), the number of levels and the original frame rate of the game in frames per second.

• One line with nnn integers ℓ\ellℓ (1≤ℓ≤1061 \leq \ell \leq 10^61≤ℓ≤106), the length of each level in pixels. The total length of all levels does not exceed 10610^6106 pixels.

Çıxış formatı

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}10−6.

Qeyd

Source: Delft Algorithm Programming Contest 2024 · Author: Mike de Vries · License: CC BY-SA 4.0 · Original: https://dapc.wisv.ch · Statement adapted for AlgoLens and shared under the same license. · 50 of the 170 original test cases (the largest) are omitted here to keep the problem lightweight.

Nümunələr

Giriş #1

1 10
1234

Çıxış #1

1.234

Giriş #2

1 10
12

Çıxış #2

0.1

Giriş #3

2 10
6245 6212

Çıxış #3

12.49

Giriş #4

2 20
6245 6212

Çıxış #4

12.47409677

Giriş #5

3 50
7146 2657 8164

Çıxış #5

17.96910941