P29779 [洛谷] [COCI2016-2017#7] PARALELOGRAMI
入门
题目描述

Problem Description

Recently, a game called Parallelograms has rapidly gained popularity on the internet. The game starts with $N$ points, each with distinct coordinates. In each move, you can select three non-collinear points $A, B, C$, and then draw point $D$ such that the quadrilateral $ACBD$ is a parallelogram with $AB$ as the diagonal. Then, move point $C$ to point $D$. Note that there is exactly one such point $D$.

Although initially all points have distinct coordinates, you can make some points have the same coordinates through several moves. Meanwhile, the absolute values of all coordinates must not exceed $10^9$.

Now, please use at most $2500$ moves to ensure that all points are in the first quadrant, or report that no such operation scheme exists. Note that you do not need to find the operation scheme with the least number of moves; you only need to find a scheme that satisfies the requirements with no more than $2500$ moves.

Input Format

The first line contains an integer $N$, representing the number of points.
The following $N$ lines each contain two integers $X_i, Y_i$, representing the x-coordinate and y-coordinate of the $i$-th point, respectively.

Output Format

If there is no solution, output a single line -1.

Otherwise, the first line should contain an integer $M$, representing the number of moves.
The following $M$ lines each contain three integers $A, B, C$, representing the indices of the three points selected in one move. Point $C$ is transformed according to the rules described in the problem, while points $A$ and $B$ remain unchanged.

Sample Input and Output

Sample Input #1

3
0 0
4 0
3 -1

Sample Output #1

1
1 2 3

Sample Input #2

4
5 0
0 5
-2 -2
-3 2

Sample Output #2

2
1 2 3
1 2 4

Sample Input #3

3
-1 -1
-2 -2
-3 -3

Sample Output #3

-1

Notes

[Data Range]

For all data, $3 \leqslant N \leqslant 400$, $-10 \leqslant X_i, Y_i \leqslant 10$.

[Problem Source]

This problem is from COCI 2016-2017 CONTEST 7 T5 PARALELOGRAMI, configured according to the original problem data, with a full score of $140$ points.

Provided by Eason_AC for translation and arrangement.

Thanks to mutton for providing the SPJ for this problem. If you have any hack data, please contact mutton directly via private message.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 0 0 4 0 3 -1
样例输出
1 1 2 3