Bitaro will participate in an aerobatics competition. In this competition, Bitaro will fly an airplane. The airplane will keep a certain altitude, and pass through the checkpoints. The area where the airplane will fly is considered as a coordinate plane. There are checkpoints, numbered from to . The coordinate of the checkpoint () is .
During the competition, the airplane must pass through each checkpoint once. More precisely, the airplane must fly in the following way.
- First, Bitaro chooses the starting checkpoint, and the airplane will start flying from there.
- Repeat the following times: Among the checkpoints which are not yet chosen, Bitaro chooses a checkpoint as the next checkpoint. Then the airplane will fly straight from the current checkpoint to the next checkpoint.
- When the airplane arrived at the last checkpoint, the flight is finished.
Here, in step 2, we consider the starting checkpoint as an already chosen checkpoint. The airplane must fly straight from a checkpoint to the next checkpoint. It is forbidden to draw a curve or make a turn on the way.
The route of the airplane is a polygonal line. During the flight, the airplane will change its direction at most times. If the angle of the polygonal line at a checkpoint is small, the change of the direction of the airplane at that checkpoint is large, and there is a risk of failure of the flight.
Therefore, Bitaro wants to make the minimum angle of the polygonal line at the checkpoints, except for the starting checkpoint and the last checkpoint, as large as possible.
Given the coordinates of the checkpoints, find an order of the checkpoints to pass so that the minimum angle of the polygonal line is as large as possible.
Input Specification
The input data is given in the following format. Given values are all integers. Here, is a parameter used by the grader.
Output Specification
The output should consist of lines. The -th line () of the output should contain the integer (), which is the -th checkpoint in the route of the airplane. Here, the starting checkpoint is the first checkpoint .
Constraints
- .
- ().
- ().
- .
Library
In this task, you can use a library which contains a function calculating an angle determined by three points.
The library is contained in the file aerobatics.h
in the archive. The specification is as follows.
double GetAngle(int xa, int ya, int xb, int yb, int xc, int yc)
This function calculates the angle in degrees. It returns a real number with sufficiently small error. Make sure the order of the parameters.- Concerning the point , the parameter
xa
is the -coordinate of the point , and the parameterya
is the -coordinate of the point . - Concerning the point , the parameter
xb
is the -coordinate of the point , and the parameteryb
is the -coordinate of the point . - Concerning the point , the parameter
xc
is the -coordinate of the point , and the parameteryc
is the -coordinate of the point . - If the coordinates of the points , are the same or the coordinates of the points , are the same, the behavior of this function is undefined.
- Concerning the point , the parameter
In your program calculating the solutions of this task, you may use the function GetAngle
in the library. If
you use it, you may modify the function.
The GetAngle
is the same as the function used by the grader.
Grading
For each output data, your score is calculated in the following way.
If your output is incorrect, your score is . For example, if the output sequence is not a permutation of or the format of the output is incorrect, your score is .
If your output is correct, your score is calculated as follows. Let (degree) be the minimum angle of the polygonal line at the checkpoints, except for the starting checkpoint and the last checkpoint. Then your score is calculated by the following formula.
- If , your score is .
- If , your score is .
Here the function () is defined by .
Your score for this task is the sum of your scores for the input data, rounded to the nearest integer.
For each input data, the values of , and the score are given in the following table:
Subtask | Input Data | score | ||
---|---|---|---|---|
input_01.txt |
||||
input_02.txt |
||||
input_03.txt |
||||
input_04.txt |
||||
input_05.txt |
||||
input_06.txt |
Sample Input
7 90
3 1
2 5
0 2
-1 6
-3 1
-1 -4
4 -2
Sample Output
5
3
1
7
6
4
2
Explanation for Sample
If the airplane will pass through the checkpoints in this order, the route of the airplane is as in the following figure. The checkpoint with the smallest angle is checkpoint . Its angle is (degree). Since (degree), your score for this output will be about of the score of this input data.
Attachment Package
The test cases and the helper library are available here.
Comments