Egor was in a hurry to get to the university on time. He was near the
university already and it only remained to cross a road. Egor came up to
the curb, looked to the left, and saw n approaching cars. Then he looked
to the right and saw m cars. “I should leap right now, but my life is
more important for me than the lectures,” he thought.
Yekaterinburg has right-hand traffic. The speed of all cars is 20 km/h.
Egor's speed is 5 km/h. The width of the road is 4 meters (two lanes
2 meters wide each). Each car is 2 meters wide and 5 meters long. Egor can
start crossing the road only at the point he has approached it. He should
cross the road orthogonally, without changing his speed or stopping.
Find the minimum time after which Egor can start crossing the road. It is
guaranteed that Egor will be able to cross the road before any new cars
In the first line you are given the number n of the cars approaching
from the left (1 ≤ n ≤ 300). In the
second line you are given integers d1, d2, …, dn, which are
the distances to these cars in meters (1 ≤ di ≤ 10 000; di −
di−1 ≥ 5).
In the third line you are given the number m of the cars approaching
from the right (1 ≤ m ≤ 300). The fourth line contains distances to
these cars in the same format as the distances to the cars from the left.
Output the minimum time in seconds after which Egor can start crossing the
road. The answer must be accurate to at least six fractional digits.
Problem Author: Egor Shchelkonogov
Problem Source: Ural Regional School Programming Contest 2011