A man is moving on a raft near a village. The raft is travelling at a constant speed raftSpeed on a river that coincides with the X axis. The man can leave the raft, visit some sites in the village, and return back to the raft. The man leaves the raft as many times as he wants. During this entire time, the raft will continue to move at its original constant speed. The man can run with speed runSpeed, where runSpeed is greater than raftSpeed. He wants to visit at least K different sites. The raft starts infinitely to the left, passes the village, and moves infinitely to the right.
You will be given two int[]s x and y containing the coordinates of all the sites in the village. The i-th site is located at (x[i], y[i]).
Return the minimal time the man must spend outside the raft to visit at least K different sites and return to the raft.
You should neglect the sizes of the raft, the man, and the sites; assume they are all points.
|