#P6441. [COCI 2011/2012 #6] PASTELE
[COCI 2011/2012 #6] PASTELE
Description
The gift contains crayons. The color of each crayon is made up of the three primary colors of light: red, green, and blue, represented by parameters . The color of this crayon is determined by these three parameters.
For two crayons , we define their difference value as . We define the color value of a set of crayons as the maximum difference value among any pair of crayons in this set.
Given the parameters of these crayons, find crayons such that the color value is minimized.
Input Format
The first line contains two integers .
The next lines each contain three integers , representing the color parameters of the -th crayon.
Output Format
The first line outputs one integer, the minimum possible color value of the selected crayons.
The next lines each contain three integers, describing which crayons make up these crayons.
Since the composition of the solution may not be unique, this problem uses SPJ.
2 2
1 3 2
2 6 4
3
1 3 2
2 6 4
3 2
3 3 4
1 6 4
1 1 2
2
3 3 4
1 1 2
5 3
6 6 4
6 2 7
3 1 3
4 1 5
6 2 6
2
6 2 7
4 1 5
6 2 6
Hint
Constraints
- For of the testdata, is guaranteed.
- For another of the testdata, is guaranteed.
- For of the testdata, , , .
Hint
Please pay attention to the impact of constant factors on program efficiency.
Notes
This problem is translated from COCI2011-2012 CONTEST #6 T5 PASTELE.
Translated by ChatGPT 5
京公网安备 11011102002149号