410021: GYM103914 K Symmetry: Convex

Memory Limit:0 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Symmetry: Convextime limit per test2 secondsmemory limit per test256 mebibytesinputstandard inputoutputstandard output

Given is a strictly convex polygon with $$$n$$$ vertices $$$p_1, p_2, \ldots, p_n$$$ in counterclockwise. Denote $$$C_i$$$ as the polygon with $$$i$$$ vertices $$$p_1, p_2, \ldots, p_i$$$. For each $$$i=3, 4, \ldots, n$$$, find the lines which $$$C_i$$$ is symmetric about.

Input

There are multiple test cases. The first line of input contains an integer $$$T$$$ ($$$1\le T\le 10^5$$$), the number of test cases. For each test case:

The first line contains an integer $$$n$$$ ($$$3 \le n \le 3 \cdot 10^5$$$), the number of vertices.

The $$$i$$$-th of the following $$$n$$$ lines contains two integers $$$x_i$$$, $$$y_i$$$ ($$$-10^9 \le x_i, y_i\le 10^9$$$), the coordinates of $$$p_i$$$.

It is guaranteed that the vertices are given counterclockwise, and the polygon is strictly convex, that is, no three vertices are collinear.

It is guaranteed that the sum of $$$n$$$ in all test cases does not exceed $$$3 \cdot 10^5$$$.

Output

For each test case:

For each $$$i=3, 4, \ldots, n$$$, on the first line, output an integer $$$k$$$: the number of lines which $$$C_i$$$ is symmetric about.

In each of the following $$$k$$$ lines, output three integers $$$a$$$, $$$b$$$, $$$c$$$ ($$$-2 \cdot 10^{18} \le a, b, c \le 2 \cdot 10^{18}$$$), denoting that $$$C_i$$$ is symmetric about the line $$$ax+by+c=0$$$.

If there are multiple answers, you can output any of them. For each $$$i$$$, you can output the lines in any order.

ExampleInput
3
4
0 0
1 0
1 1
0 1
3
0 0
3 0
1 1
4
-1000000000 -1000000000
1000000000 -1000000000
1000000000 1000000000
-1000000000 1000000000
Output
1
1 1 -1
4
1 -1 0
0 2 -1
2 0 -1
1 1 -1
0
1
1 1 0
4
1 -1 0
0 1 0
1 0 0
1 1 0

Source/Category

加入题单

上一题 下一题 算法标签: