QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 512 MB 満点: 100

#8360. distance

統計

This is the only problem without a background story.

Little Z has a 2D plane with $n$ points, where the $i$-th point has coordinates $(x_i, y_i)$.

Little Z wants to move these points. There are $n$ available movement methods, where the $i$-th method is represented by a vector $(u_i, v_i)$. Applying the $i$-th movement method to the $j$-th point changes the coordinates of the $j$-th point to $(x_j + u_i, y_j + v_i)$.

Little Z will apply exactly one movement method to each point, using each method exactly once. This is equivalent to finding a permutation $p$ of order $n$ and applying the $p_i$-th movement method to the $i$-th point.

Little Z is interested in the distances between these points. Little Z prefers larger distances, so Little Z wants the distance between any two points after the movement to be no smaller than it was before. The distance between two points $(x_1, y_1)$ and $(x_2, y_2)$ is defined as $\sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}$.

Little Z wants to know if there exists a way to perform these operations that satisfies the requirement. If such a way exists, Little Z also wants to maximize the sum of the squared distances between all pairs of points. You need to find such a way. If your solution satisfies the requirement but does not maximize the sum of squared distances, you will receive half the points.

Input

The first line contains a positive integer $n$, representing the number of points.

The next $n$ lines each contain two integers $x_i, y_i$, representing the coordinates of the points.

The next $n$ lines each contain two integers $u_i, v_i$, representing the coordinates of the vectors.

Output

If no such way exists, output a single string No.

Otherwise, first output a single string Yes, followed by a line containing a permutation $p_1, \dots, p_n$ of order $n$, representing the solution you found.

Note that the spj (special judge) is case-sensitive.

Examples

Input 1

2
1 1
-1 -1
-1 -1
1 1

Output 1

Yes
2 1

Note that $(1, 2)$ is not a valid solution here, because after applying the operations according to $(1, 2)$, the two points coincide, and the distance decreases.

Input 2

5
1 1
4 5
1 4
1 9
1 9
8 1
1 9
2 6
0 8
1 7

Output 2

Yes
1 3 5 2 4

This is just one possible output; there are other optimal solutions, such as $(1, 3, 5, 4, 2)$.

Note that points can overlap (and vectors can be zero vectors).

Constraints

For all data, $n \leq 500, |x_i|, |y_i|, |u_i|, |v_i| \leq 10^4$.

If you correctly determine whether a solution exists for all test cases, and output a valid solution for cases where one exists, you will receive $50\%$ of the points.

On top of that, if for every test case you output a solution that maximizes the sum of squared distances among all valid solutions, you will receive full points.

Subtask Score Special Constraints
$1$ $20$ $n \leq 10$
$2$ $10$ $n \leq 20$
$3$ $20$ $n \leq 50$
$4$ $34$ $n \leq 150$
$5$ $16$ No special constraints

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.