Aerobatics 2
Time limit1sMemory limit512 MB
Find a visiting order of N checkpoints so that the smallest turning angle at the intermediate checkpoints is as large as possible.
Problem
Bitaro will take part in an aerobatics competition and fly an airplane. The airplane keeps a fixed altitude and passes through checkpoints on a coordinate plane. There are checkpoints, numbered 1 to . Checkpoint () is at .
The airplane must pass each checkpoint exactly once, as follows.
- Bitaro chooses the starting checkpoint. The airplane starts flying from there.
- Repeat the following times. Bitaro chooses the next checkpoint from those not yet chosen, and the airplane flies straight from the current checkpoint to it.
- When the airplane reaches the last checkpoint, the flight ends.
In step 2, the starting checkpoint counts as already chosen. The airplane must fly straight from one checkpoint to the next. It may not draw a curve or turn partway along a segment.
The route is a polygonal line. The airplane changes direction at most times. If the angle of the route at a checkpoint is small, the direction change there is large, which risks failing the flight.
Bitaro wants the minimum angle of the route at the checkpoints other than the starting and last checkpoints to be as large as possible. Given the coordinates, find a visiting order that maximizes this minimum angle.
Input
The first line contains and .
Each of the next lines contains the coordinates and of one checkpoint, separated by a space. is a parameter used by the grader.
Output
Print lines. The -th line contains (), the number of the -th checkpoint on the route. The starting checkpoint is .
Constraints
- .
- ().
- ().
- .