#P10088. [ROIR 2022] n 巧板 (Day 1)

    ID: 10744 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>数学2022Special Judge枚举ROIR(俄罗斯)

[ROIR 2022] n 巧板 (Day 1)

Background

Translated from ROIR 2022 D1T3.

There is a puzzle consisting of nn 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 tt, the index of the current test point.

The second line contains an integer nn, the number of triangles in the puzzle (4n304 \le n \le 30).

The next nn 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 10510^5. 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 2222 test points. The first two test points are samples; passing them gives no score. The remaining 2020 test points are worth 55 points each.

Test Point Index Special Property
11 The input is exactly Sample 11
22 The input is exactly Sample 22
33 All triangles are congruent, n30n\le30
44 All triangles have one horizontal side and one vertical side, and all of them are isosceles triangles, n10n\le10
55 All triangles have one horizontal side and one vertical side, and all of them are isosceles triangles, n30n\le30
66 All triangles have one horizontal side and one vertical side, and n10n\le10
77 All triangles have one horizontal side and one vertical side, and n30n\le30
88 All triangles are right triangles, and n10n\le10
99 All triangles are right triangles, and n30n\le30
1010 For every four small triangles that can form a large triangle, they can do so without rotation, and n10n\le10
1111 For every four small triangles that can form a large triangle, they can do so without rotation, and n20n\le20
1212 For every four small triangles that can form a large triangle, they can do so without rotation, and n30n\le30
1313 n=10n=10
1414
1515
1616 n=20n=20
1717
1818
1919 n=30n=30
2020
2121
2222

Translated by ChatGPT 5