Problem G
Cliff Walk

One morning last summer, Charlotte was watching the moon and the sun and observed that the moon was full. As she lives along the Atlantic coast she knows that this means a larger variation in the tide compared to first and last quarter. With no rain in the air, it seemed like a perfect week for walks at the beach by the cliffs.
The tide is dangerous when walking at the beach between the sea and the cliff wall. As the water rises, you may get trapped. Therefore it is important to plan the walk according to the behaviour of the tide.
One simple way of cliff walk planning is just to start walking and turn around at low tide. The problem is that on a rocky beach, you want the rocks to dry for one hour before entering them. It could therefore actually be safe to continue the walk a bit further even after low tide. Note that the beach is mostly made of sand and the rocks have many cracks in them, so we assume that all areas are flooded or drained at the exact moment when the tide reaches their height, irrespective of the heights of the neighbouring areas.
The beach has been surveyed and a map is available where
each
The tide behaves differently at different places on the
Earth depending on the sea bottom, coast line etc. Charlotte
knows that it is possible to approximate the tide’s water level
Charlotte will start and finish her walk at her home. She
limits her time away from home to only one tide interval, so
you may assume that
Input
The first line of the input contains two floating point
numbers
Then follow
Output
Output one line with the maximum Euclidean distance that
Charlotte can get from home. The distance between two squares
should be measured between their centers. The answer is
considered correct if it has an absolute or relative error of
at most
To avoid problems with floating point numbers, the result is
guaranteed to be the same for all walking speeds
Sample Input 1 | Sample Output 1 |
---|---|
2.0 10.0 3 3 0 0 2001 1000 100 1001 10000 200 100 0 0 |
20 |
Sample Input 2 | Sample Output 2 |
---|---|
4.0 30.0 6 2 2 0 73 1001 4001 1001 76 70 70 2001 3001 2001 72 71 |
22.36067977 |