There is a street of length l meters stretching from left to right, with n small routers occupying various distinct positions along it. The origin is defined to be the leftmost point of the street. The routers are labelled 0 to n−1 from left to right, and router i is placed p\[i] meters away from the origin.
It is guaranteed that router 0 is at the origin, and the distance in meters from each router to the origin is an even integer.
You wish to find out the position of each of the n routers. As the routers are very small and difficult to spot from afar, you've decided to use the following procedure to find them:
You are allowed to use the detector at most q times. Devise a strategy to find the positions of all the routers.