#P10088. [ROIR 2022] n 巧板 (Day 1)
[ROIR 2022] n 巧板 (Day 1)
Background
Translated from ROIR 2022 D1T3.
There is a puzzle consisting of triangles. To solve this puzzle, you need to choose four triangles and combine them into one large triangle according to the following rules:

These triangles must not intersect, and their union must form a triangle. Among the four chosen triangles, exactly three triangles are at the corners, and the remaining one triangle is in the center.
The triangles are placed on a table and can be freely rotated and moved, but cannot be flipped.
Problem Description
You need to find all sets of four distinct triangles that can be combined into a large triangle according to the specified rules. If there exists a triangle that belongs to one set but does not belong to another set, then the two sets are considered different.
Input Format
The first line contains an integer , the index of the current test point.
The second line contains an integer , the number of triangles in the puzzle ().
The next lines each contain six numbers, describing the coordinates of the three vertices of a triangle, given in counterclockwise order. All coordinates are integers and do not exceed . It is guaranteed that no triangle degenerates into a line segment. Triangles in the initial positions may intersect.
Output Format
The first line outputs an integer, the number of sets of four triangles that can be combined into a large triangle according to the specified rules.
Each of the following lines outputs one such set. Each set is given by the indices of the triangles it contains. The triangles within a set may be output in any order. The sets themselves may also be output in any order.
1
4
0 0 6 2 1 2
0 0 5 0 6 3
0 0 3 1 1 3
0 0 6 3 3 6
1
1 2 3 4
2
6
0 0 1 0 1 1
0 1 0 0 1 0
-1 0 0 0 0 1
1 1 0 1 1 0
-1 0 0 -1 0 0
0 0 1 1 0 1
15
1 2 3 4
1 2 3 5
1 2 3 6
1 2 4 5
1 2 4 6
1 2 5 6
1 3 4 5
1 3 4 6
1 3 5 6
1 4 5 6
2 3 4 5
2 3 4 6
2 3 5 6
2 4 5 6
3 4 5 6
Hint
This problem has test points. The first two test points are samples; passing them gives no score. The remaining test points are worth points each.
| Test Point Index | Special Property |
|---|---|
| The input is exactly Sample | |
| The input is exactly Sample | |
| All triangles are congruent, | |
| All triangles have one horizontal side and one vertical side, and all of them are isosceles triangles, | |
| All triangles have one horizontal side and one vertical side, and all of them are isosceles triangles, | |
| All triangles have one horizontal side and one vertical side, and | |
| All triangles have one horizontal side and one vertical side, and | |
| All triangles are right triangles, and | |
| All triangles are right triangles, and | |
| For every four small triangles that can form a large triangle, they can do so without rotation, and | |
| For every four small triangles that can form a large triangle, they can do so without rotation, and | |
| For every four small triangles that can form a large triangle, they can do so without rotation, and | |
Translated by ChatGPT 5