Activating Robots
Time limit5sMemory limit1024 MB
Given a circle of length L and activation points, find the minimum time for you and robots moving at speed 1/K to form R equally spaced robots.
- Level
Hard8 of 10
- Topics
- Greedy, Binary search, Math, Implementation
- Solved
- No attempts yet
Problem
You and a single robot are initially at point on a circle with perimeter (). You can move either counterclockwise or clockwise along the circle at unit per second. All movement in this problem is continuous.
Your goal is to place exactly robots so that, at the end, every two consecutive robots are apart (, and divides ). There are () activation points. The th one is units counterclockwise from (). If you are at an activation point, you can instantly place a robot there. All robots, including the original one, move counterclockwise at a rate of unit per seconds ().
Compute the minimum time required to reach the goal.
Input
The first line contains , , , and .
The next line contains space-separated integers .
Output
Print the minimum time required to reach the goal.