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

FPC23-028.Admiring Droplets

Easy · 3 s · 256 MB

  • icpc
  • fpc
  • 2023

On a rainy day, Davina is travelling by train to the Fluffy Puppy College. It is a long ride, and she is dozing away, admiring the rain droplets rolling down the window. Some droplets appear to go faster than others, so she pretends that the droplets are racing each other to the bottom. Shaking herself awake, she wants to see if she can predict how fast exactly these droplets roll down the window.

For all droplets she sees in one vertical line on the window, she has noted the sizes and positions of these droplets. She finds the velocity of a droplet to be exactly proportional to the sixth root of its volume:

v=V6v = \sqrt[6]{V}v=6V​, where vvv is in m/s\text m/\text sm/s and VVV is in m3\text{m}^3m3. When two droplets meet, they coalesce into a single droplet, the speed of which immediately changes according to this equation. You can assume the droplets to be point-like. ( I.e., to be infinitesimally small / dimensionless. )

Initially, all droplets are stationary. From the moment that the droplet at the very top starts rolling down the window, calculate the time that it takes for the fully coalesced droplet to reach the bottom of the window.

As an example, consider the first sample input. The first droplet starts rolling with a velocity of v=10⋅10−96 m/s≈46 mm/sv = \sqrt[6]{10 \cdot 10^{-9}} \text{ m}/\text{s} \approx 46\text{ mm}/\text{s}v=610⋅10−9​ m/s≈46 mm/s. It meets the second droplet after 100/46≈2.2 s100/46 \approx 2.2\text{ s}100/46≈2.2 s. They coalesce into a droplet of 40 mm340\text{ mm}^340 mm3 with a speed of v=40⋅10−96 m/s≈58 mm/sv = \sqrt[6]{40 \cdot 10^{-9}} \text{ m}/\text{s} \approx 58\text{ mm}/\text{s}v=640⋅10−9​ m/s≈58 mm/s. This new droplet meets the third droplet after 200/58≈3.4 s200/58 \approx 3.4\text{ s}200/58≈3.4 s. The fully coalesced droplet has a volume of 60 mm360\text{ mm}^360 mm3 and a speed of v=60⋅10−96 m/s≈63 mm/sv = \sqrt[6]{60 \cdot 10^{-9}} \text{ m}/\text{s} \approx 63\text{ mm}/\text{s}v=660⋅10−9​ m/s≈63 mm/s. It reaches the bottom of the window after 100/63≈1.6 s100/63 \approx 1.6\text{ s}100/63≈1.6 s. This makes the total time 2.2+3.4+1.6≈7.2 s2.2+3.4+1.6 \approx 7.2\text{ s}2.2+3.4+1.6≈7.2 s.

Giriş formatı

The input consists of:

• One line with two integers nnn and hhh (1≤n≤1051\leq n\leq 10^51≤n≤105, n≤h≤109n\leq h\leq 10^9n≤h≤109), the number of droplets and the height of the window in mm\text{mm}mm.

• nnn lines, each with two integers sss and yyy (1≤s≤3001\leq s\leq 3001≤s≤300, 0≤y<h0 \leq y < h0≤y<h), the size of a droplet in mm3\text{mm}^3mm3 (μL\mu\text{L}μL) and the distance of a droplet from the top of the window in mm.

The yyy-coordinates of the droplets are strictly increasing (i.e., they are distinct and ordered from top to bottom).

Çıxış formatı

Output the time it takes for the fully coalesced droplet to reach the bottom of the window after the first droplet starts rolling, in seconds.

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

Qeyd

\pagebreak

Source: Freshmen Programming Contest 2023 · Author: Davina van Meer and Maarten Sijm · License: CC BY-SA 4.0 · Original: https://fpc.wisv.ch · Statement adapted for AlgoLens and shared under the same license. · 3 of the 19 original test cases (the largest) are omitted here to keep the problem lightweight.

Nümunələr

Giriş #1

3 500
10 100
30 200
20 400

Çıxış #1

7.17262460528476

Giriş #2

5 1000
1 100
42 200
300 300
100 400
10 500

Çıxış #2

12.89774177896886