ploaia
Researchers at the Meteorological Institute have decided to study the lake formation process during rainfall, on various relief types. For the research they constructed a relief model that has only two lengths - height and length. In this model relief is represented by a broken line comprised of N segments, each having, in order, extremity coordinates (x0, y0), ..., (xN, yN), where x0
< x1 < ... < xN and yi <>
yj, for any i <> j. In the extreme points (x0, y0) and (xN, yN) relief is considered as being limited by vertical mountains of infinite height. Task Write a program that determines the maximum depth of lakes formed as the result of rainfall. Input Data Input file ploaia.in
contains on the first line a positive integer N
and an integer with 3 decimals H,
separated by a space, representing the number of segments that form the
relief line, and namely depth of the water if the relief was flat. The
next N+1 lines contain
in order the extremities of the segments, one extremity per line. For
each extremity two integers are specified xi
and yi,
representing the abscise and the ordinate of said point. |
![]() |
Output Data
Output file ploaia.out will contain on the first line the maximum depth, calculated with at least 4 decimals.
Constraints and Statements
ploaia.in | ploaia.out |
7 7.000 |
15.8446 |
Time limit: 0.1 seconds/test
prof. Sergiu Corlat
Moldavian-Turkish High School, Chişinău
Contact:scorlat@gmail.com