ICPC North America Qualifier 2016, Problem L
In the game of Unusual Darts, Alice throws seven darts onto a -foot by -foot board, and then Bob may or may not throw three darts.
Alice's seven darts define a polygon by the order in which they are thrown, with the perimeter of the polygon connecting Dart to Dart to Dart to Dart to Dart to Dart to Dart , and back to Dart .
If the polygon so defined is not simple (meaning it intersects itself) then Alice loses. If the polygon is simple, then Bob throws three darts. He is not a very good player, so although his darts always land on the board, they land randomly on the dart board following a uniform distribution. If all three of these darts land within the interior of the polygon, Bob wins, otherwise Alice wins.
For this problem you are given the locations of Alice's darts (which form a simple polygon) and the probability that Bob wins. Your job is to determine the order in which Alice threw her darts.
Input Specification
The first line of input contains an integer , indicating the number of Darts games that follow. Each game description has lines. Lines through each have a pair of real numbers with digits after the decimal point. These indicate the and coordinates of Alice's seven darts ( to ), which are all at distinct locations. All coordinates are given in feet, in the range . The line contains a real number with digits after the decimal point, giving the probability that Bob wins. In all test cases, Alice's darts do form a simple polygon, but not necessarily in the order given.
Output Specification
For each Darts game, output the order in which the darts could have been thrown, relative to the order they were given in the input, so that Bob wins with probability . If several answers are possible, give the one that is lexicographically least. Any ordering that would give Bob a probability of winning within of the given value of is considered a valid ordering.
Sample Input
3
0.000 0.000
0.000 2.000
1.000 1.800
1.000 0.200
1.800 1.000
2.000 0.000
2.000 2.000
0.61413
0.000 0.000
0.000 2.000
1.000 1.800
1.000 0.200
1.800 1.000
2.000 0.000
2.000 2.000
0.12500
0.000 0.000
0.000 1.900
0.400 2.000
1.700 0.000
1.800 2.000
2.000 0.200
2.000 0.600
0.86416
Sample Output
1 2 3 7 5 6 4
1 4 3 2 7 5 6
1 2 3 5 7 6 4
Comments