#P8585. 球状精灵的传说
球状精灵的传说
Problem Description
In the Trifid Nebula in Sagittarius, you discovered a new kind of creature: spherical sprites.
A spherical sprite is a sprite whose shape is a standard ellipsoid. Each sprite has three-dimensional radii , which represent its scale along the three directions in the 3D world.
There is a legend about spherical sprites: the one with the highest prestige in the tribe will get a chance to ascend into the four-dimensional universe. The prestige value of a spherical sprite with radii is defined as:
$$\rho=\left\lfloor{\frac{1}{4}\min\{r_1,r_2,r_3\}^3}\right\rfloor$$where denotes the floor function.
Also, each spherical sprite may choose to hug at most once with another sprite. After that, the two sprites will merge into one new spherical sprite. Two spherical sprites can hug if and only if they have at least one radius face that can coincide. More specifically, the radii of the two sprites must have at least two equal values.
For example, if the three radii of two sprites are and , then they can choose to hug and create a new sprite with radii . Note that sprites are floating in space, so they can rotate freely. For instance, a sprite with radii can be rotated into . A new sprite formed by hugging cannot participate in hugging again.
Now the spherical sprites want to know: among all sprites that can ascend into the four-dimensional universe, what is the maximum possible prestige value?
Please read the input and output formats carefully for more detailed information.
Input Format
The first line contains one positive integer , the number of spherical sprites in the tribe initially. Initially, none of the sprites has hugged.
Lines to each contain three non-negative integers , representing the three radii of spherical sprite .
Output Format
The first line outputs an integer :
- If, in the optimal case, the spherical sprite that ascends into four-dimensional space is one of the original sprites that has not hugged, then .
- If, in the optimal case, the sprite that ascends into four-dimensional space is formed by hugging two original sprites, then .
The second line has two cases:
- If , output one integer , meaning the sprite that ascends is sprite .
- If , output two integers , meaning the final ascending sprite is formed by a hug between sprites and .
The third line outputs one integer, the prestige value of the sprite that ascends into four-dimensional space in the optimal case.
If there are multiple optimal solutions, output any one of them.
4
1 3 5
1 2 3
2 2 3
4 3 5
0
4
6
10
2 5 5
4 3 3
1 3 2
3 4 3
3 2 5
3 4 3
2 3 4
4 5 5
2 3 4
5 3 4
1
1 8
31
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, , .
Translated by ChatGPT 5