Messenger
Time limit4sMemory limit128 MB
A unit-speed messenger runs straight from the first of two speed-1 polygonal routes to intercept the second, so minimize the carry time.
- Level
Medium7 of 10
- Topics
- Geometry, Binary search
- Solved
- No attempts yet
Problem
Misha and Nadia each follow a polyline path in the plane at speed 1. Misha hands a package to a messenger at some point on his path. The messenger runs in a straight line to meet Nadia on her path and hands it over. The messenger also moves at speed 1. Find the minimum time from pickup to delivery.
Input
Two path descriptions are given. Each starts with points visited in order. Misha and Nadia start at the same time without stopping. Pickup must happen no later than when Misha finishes, and delivery no later than when Nadia finishes.
Output
Print the minimum delivery time with absolute error at most or relative error at most . Print impossible if delivery cannot happen.