loj#P3487. 「JOISC 2021 Day1」特技飞行
「JOISC 2021 Day1」特技飞行
Description
Original problem at JOISC 2021 Day1 T1 Aerobatics.
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 the 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 Format
The first line consists two integers and , where is a parameter used by the grader.
In the following lines, there are two integers and each line.
Output Format
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 .
Submission
Submit output data output output_01.txt, output_02.txt, ..., output_06.txt
for each of the input files input_01.txt, input_02.txt, ..., input_06.txt
.
Constraints
For all test data, it is guaranteed that,
-
。
-
$\sqrt{X_i^2+Y_i^2} \le 10\,000\,000\ (1 \le i \le N)$。
-
。
-
。
Library
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 degree. 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 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 S \times \dfrac{f(Z/180)}{f(Z_0/180)}$
Here function is defined by .
Your score for this task is the sum of your scores for the 6 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 |
7 90
3 1
2 5
0 2
-1 6
-3 1
-1 -4
4 -2
5
3
1
7
6
4
2