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:
, where is in and is in . 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 . It meets the second droplet after . They coalesce into a droplet of with a speed of . This new droplet meets the third droplet after . The fully coalesced droplet has a volume of and a speed of . It reaches the bottom of the window after . This makes the total time .
Giriş formatı
The input consists of:
• One line with two integers and (, ), the number of droplets and the height of the window in .
• lines, each with two integers and (, ), the size of a droplet in () and the distance of a droplet from the top of the window in mm.
The -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 .
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