AtCoder Beginner Contest 373
翻译中…
Problem Statement
翻译中…
There are $2N$ points $P_1,P_2,\ldots,P_N, Q_1,Q_2,\ldots,Q_N$ on a two-dimensional plane. The coordinates of $P_i$ are $(A_i, B_i)$, and the coordinates of $Q_i$ are $(C_i, D_i)$. No three different points lie on the same straight line.
翻译中…
Determine whether there exists a permutation $R = (R_1, R_2, \ldots, R_N)$ of $(1, 2, \ldots, N)$ that satisfies the following condition. If such an $R$ exists, find one.
翻译中…
- For each integer
$i$from$1$through$N$, let segment$i$be the line segment connecting$P_i$and$Q_{R_i}$. Then, segment$i$and segment$j$$(1 \leq i < j \leq N)$never intersect.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 300$$0 \leq A_i, B_i, C_i, D_i \leq 5000$$(1 \leq i \leq N)$$(A_i, B_i) \neq (A_j, B_j)$$(1 \leq i < j \leq N)$$(C_i, D_i) \neq (C_j, D_j)$$(1 \leq i < j \leq N)$$(A_i, B_i) \neq (C_j, D_j)$$(1 \leq i, j \leq N)$- 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:
翻译中…
N
A_1 B_1
A_2 B_2
\vdots
A_N B_N
C_1 D_1
C_2 D_2
\vdots
C_N D_N
翻译中…
Output
翻译中…
If there is no $R$ satisfying the condition, print -1.
翻译中…
If such an $R$ exists, print $R_1, R_2, \ldots, R_N$ separated by spaces. If there are multiple solutions, you may print any of them.
翻译中…
样例
Input #1
3
0 0
2 4
4 2
0 2
2 0
4 4
Output #1
2 1 3
The points are arranged as shown in the following figure.

By setting $R = (2, 1, 3)$, the three line segments do not cross each other. Also, any of $R = (1, 2, 3)$, $(1, 3, 2)$, $(2, 3, 1)$, and $(3, 1, 2)$ is a valid answer.
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
Output #2
3 5 8 2 7 4 6 1
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。