Patrol Robot

시간 제한3초메모리 제한2048 MB

문제

The Coordinate Control Organization has developed an autonomous robot to patrol $N$ distinct important locations on a two-dimensional plane. The $i$-th location has coordinates $(x_i , y_i)$, and it is guaranteed that no three locations lie on a common line.

To help guide the robot, you may paint some line segments on the ground. Each segment must directly connect two important locations, and no two segments may intersect, except possibly at their endpoints.

The robot will begin its patrol at the midpoint of an arbitrary segment, facing towards one of its endpoints. It will move indefinitely according to the following procedure:

  • As long as the robot is in the interior of a segment, it will move forward, towards a segment endpoint.
  • When the robot reaches an important location, it will initially be facing directly away from the segment it just traversed. The robot will turn right/clockwise until its line of vision is aligned with a segment that leads away from the current location. The robot will then begin moving along this new segment.

Your task is to paint the segments in such a way that, no matter where the robot starts, it is guaranteed to visit every important location infinitely often. It can be proven that this is always possible.

입력

The first line of input contains a single integer $N$ ($2 ≤ N ≤ 2\, 000$), the number of important locations.

The next $N$ lines of input each contain two space-separated integers, $x_i$ and $y_i$ ($−10^9 ≤ x_i , y_i ≤ 10^9$), the coordinates of the $i$-th important location.

It is guaranteed that all $N$ important locations are distinct and no three lie on a common line.

출력

On the first line, output a positive integer $M$, the number of line segments you paint on the ground.

The next $M$ lines of output should each contain two space-separated integers, $u_i$ and $v_i$ ($1 ≤ u_i , v_i ≤ N$, $u_i \ne v_i$), denoting that you paint a line segment between the $u_i$-th and $v_i$-th important locations.

If there are multiple acceptable answers, output any of them.