Travel Guide
Time limit2sMemory limit128 MB
Find the minimum time for a guide starting at the origin to intercept N moving tourists in some order and send them home, then return herself.
- Level
Hard9 of 10
- Topics
- Brute force, Binary search, Geometry, Math
- Solved
- No attempts yet
Problem
Yoonhwa is a travel guide who leads tourists on a bus. One day, she is guiding tourists.
During a one-hour lunch break, each tourist goes wherever they want. At the end of the break, no tourist has returned to the bus. Yoonhwa starts from the bus, must meet every tourist, tell them to return immediately, and then return to the bus herself.
At time , the bus is at the origin . Each tourist keeps moving in a straight line from their current position with their own speed and direction. When Yoonhwa meets a tourist, that tourist immediately changes direction and moves straight back to the bus at the same speed.
Find the minimum possible time at which everyone, including Yoonhwa, has arrived back at the bus.
Input
The first line contains the number of tourists .
The second line contains Yoonhwa's speed as a decimal number.
Each of the next lines contains four decimal numbers , , , and .
- is the position of the -th tourist at time .
- is that tourist's speed .
- is that tourist's movement direction in radians , measured counterclockwise from the positive -axis.
Output
Print the minimum time, rounded to the nearest integer.
The answer is guaranteed to be at most .