Kostya is a genial sculptor, he had a idea:to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marble from which he can carve th E sphere.
Zahar has n stones which is rectangular parallelepipeds. The edges sizes of the I-th of them are ai, bi and c I. He can take no more than, stones and present them to Kostya.
If Zahar takes-stones, he should glue them together on one of the faces in order to get a new piece of rectangular par Allelepiped of marble. Thus, it is possible to glue a pair of stones together if and only if the faces on which they is glued together match as Rectangles. In such gluing it was allowed to rotate and the flip of the stones in any.
Help Zahar choose such a present so, Kostya can carve a sphere of the maximum possible volume and present it to Zahar.
Input
The first line contains the integer n (1≤ n ≤105).
n lines follow, in the I-th of which there is three integers ai, bi and Ci (1≤ ai, b i, ci ≤109)-the lengths of edges of the i-th stone. Note, that's stones may has exactly the same sizes, but they still would be considered, and different stones.
Output
The first line print k (1≤ k ≤ 2) The number of stones which Zahar have chosen. In the second line print k distinct integers from 1 to n -the numbers of stones which Zahar needs to choose. Consider that stones is numbered from 1 to N in the order as they is given in the input data.
You can print the stones in arbitrary order. If There is several answers print any of them.
Test instructions: give you n rectangles, when they are any one of the same area can be combined, up to a maximum of two, ask you to make up the maximum inner tangent to the number of rectangular combinations, if a rectangle can be composed
Max then output 1 then it's the following table, if two (up to two) output 2 then their subscript.
This problem as D is quite simple, the idea of a simple structure of the rectangular inscribed circle size depends on its minimum side, so if the smallest side of the surface to synthesize the most will not exceed the minimum edge,
So it is possible to get big with the combination of maximum and sub-large sides. So deal with 3 sides from the big to the small sort, in the order of these points from large to small. When a rectangle is first recorded
The maximum result of the subscript is how much, and then consider the two when the large side of the side of the surface combination, the maximum inscribed circle radius of min (sum, s[i].y) (sum represents two minimum sides of the sum, S[I].Y
Represents a secondary small edge). This is roughly the way of thinking.
#include <iostream> #include <cstring> #include <algorithm>using namespace std;const int M = 1e5 + 10;typ Edef Long Long ll;struct SS {ll x, y, z, num;} S[m];bool CMP (ss A, SS B) {if (a.x = = b.x) return a.y > B.y; return a.x > b.x;} int main () {int n; CIN >> N; ll MAX = 0; int temp = 0; for (int i = 0; i < n; i++) {ll A, B, C; Cin >> a >> b >> c; ll sum = a + B + C; s[i].x = Max (A, max (b, c)); s[i].z = min (A, min (b, c)); S[i].y = (sum-s[i].x-s[i].z); S[i].num = i; if (MAX < s[i].z) {temp = i; MAX = s[i].z; }} sort (s, S + N, CMP); ll sum2 = 0; int l = 0; int r = l; int L2 = l; for (int i = 0; i < n-1; i++) {if (s[i].x = = s[i + 1].x && s[i].y = s[i + 1].y) {L = i; sum2 = s[i].z + s[i + 1].z; if (MAX < min (sum2, s[i].y)) { MAX = min (sum2, s[i].y); R = i + 1; L2 = l; }}} if (R-l2 >= 1) {cout << r-l2 + 1 << endl; for (int i = L2; I <= R; i++) {cout << s[i]. num + 1 << '; }} else {cout << 1 << endl; cout << temp + 1 << endl; } return 0;}
Codeforces 733DKostya The sculptor (greedy)