I want to solve a simple enough problem, but I am so so busy that I don't have enough time. So, could you please do it for me???
I have a some trees in a forest and I have a human to catch! I have to create an enclosed area using the trees as the vertices of a polygon in such a way that the human is trapped strictly inside the polygon (strictly inside means that if the human is on the boundary of the polygon, it's not inside). Your job is to minimize the polygon's perimeter.
On the first line there will be an integer (), number of testcases. Then on the first line of each test case, there will be two integers , (), the position of the human. Then on the second line of each case, there will be an integer (), number of trees in the forest. On the next lines there will be two integers , () on each line, the position of the trees.
For each test case, you should output the case number and the minimum perimeter of the polygon in a new line. You have to print 6 digits (rounded) after the decimal point. If it's impossible, print -1. See sample test cases for clarity.
Input | Output |
---|---|
2 2 1 3 4 0 0 3 0 0 5 0 2 0 0 10 0 | Case 1: 12.000000 Case 2: -1 |