#abc373g. G - No Cross Matching
G - No Cross Matching
Score : points
问题陈述
在二维平面上有 个点 。点 的坐标是 ,点 的坐标是 。没有三个不同的点在同一条直线上。
确定是否存在一个排列 的 满足以下条件。如果存在这样的 ,请找出一个。
- 对于从 到 的每个整数 ,让线段 是连接 和 的线段。那么,线段 和线段 永远不会相交。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
There are points on a two-dimensional plane. The coordinates of are , and the coordinates of are . No three different points lie on the same straight line.
Determine whether there exists a permutation of that satisfies the following condition. If such an exists, find one.
- For each integer from through , let segment be the line segment connecting and . Then, segment and segment never intersect.
Constraints
- No three different points lie on the same straight line.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
If there is no satisfying the condition, print -1
.
If such an exists, print separated by spaces. If there are multiple solutions, you may print any of them.
Sample Input 1
3
0 0
2 4
4 2
0 2
2 0
4 4
Sample Output 1
2 1 3
The points are arranged as shown in the following figure.
By setting , the three line segments do not cross each other. Also, any of , , , and is a valid answer.
Sample Input 2
8
59 85
60 57
72 12
3 27
16 58
41 94
77 64
97 20
32 37
7 2
57 94
35 70
38 60
97 100
5 76
38 8
Sample Output 2
3 5 8 2 7 4 6 1