codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

733D.md (3446B)


      1 Source: https://codeforces.com/problemset/problem/733/D
      2 
      3 D. Kostya the Sculptor
      4 
      5 time limit per test
      6 
      7 3 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Kostya is a genial sculptor, he has an 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 the sphere.
     22 
     23 Zahar has *n* stones which are rectangular parallelepipeds. The edges sizes of the *i*-th of them are *a**i*, *b**i* and *c**i*. He can take no more than two stones and present them to Kostya.
     24 
     25 If Zahar takes two stones, he should glue them together on one of the faces in order to get a new piece of rectangular parallelepiped of marble. Thus, it is possible to glue a pair of stones together if and only if two faces on which they are glued together match as rectangles. In such gluing it is allowed to rotate and flip the stones in any way.
     26 
     27 Help Zahar choose such a present so that Kostya can carve a sphere of the maximum possible volume and present it to Zahar.
     28 
     29 Input
     30 
     31 The first line contains the integer *n* (1 ≤ *n* ≤ 105).
     32 
     33 *n* lines follow, in the *i*-th of which there are three integers *a**i*, *b**i* and *c**i* (1 ≤ *a**i*, *b**i*, *c**i* ≤ 109) — the lengths of edges of the *i*-th stone. Note, that two stones may have exactly the same sizes, but they still will be considered two different stones.
     34 
     35 Output
     36 
     37 In the first line print *k* (1 ≤ *k* ≤ 2) the number of stones which Zahar has 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 are numbered from 1 to *n* in the order as they are given in the input data.
     38 
     39 You can print the stones in arbitrary order. If there are several answers print any of them.
     40 
     41 Examples
     42 
     43 Input
     44 
     45 ```
     46 6  
     47 5 5 5  
     48 3 2 4  
     49 1 4 1  
     50 2 1 3  
     51 3 2 4  
     52 3 3 4
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 1  
     59 1
     60 ```
     61 
     62 Input
     63 
     64 ```
     65 7  
     66 10 7 8  
     67 5 10 3  
     68 4 2 6  
     69 5 5 5  
     70 10 2 8  
     71 4 2 1  
     72 7 7 7
     73 ```
     74 
     75 Output
     76 
     77 ```
     78 2  
     79 1 5
     80 ```
     81 
     82 Note
     83 
     84 In the first example we can connect the pairs of stones:
     85 
     86 * 2 and 4, the size of the parallelepiped: 3 × 2 × 5, the radius of the inscribed sphere 1
     87 * 2 and 5, the size of the parallelepiped: 3 × 2 × 8 or 6 × 2 × 4 or 3 × 4 × 4, the radius of the inscribed sphere 1, or 1, or 1.5 respectively.
     88 * 2 and 6, the size of the parallelepiped: 3 × 5 × 4, the radius of the inscribed sphere 1.5
     89 * 4 and 5, the size of the parallelepiped: 3 × 2 × 5, the radius of the inscribed sphere 1
     90 * 5 and 6, the size of the parallelepiped: 3 × 4 × 5, the radius of the inscribed sphere 1.5
     91 
     92 Or take only one stone:
     93 
     94 * 1 the size of the parallelepiped: 5 × 5 × 5, the radius of the inscribed sphere 2.5
     95 * 2 the size of the parallelepiped: 3 × 2 × 4, the radius of the inscribed sphere 1
     96 * 3 the size of the parallelepiped: 1 × 4 × 1, the radius of the inscribed sphere 0.5
     97 * 4 the size of the parallelepiped: 2 × 1 × 3, the radius of the inscribed sphere 0.5
     98 * 5 the size of the parallelepiped: 3 × 2 × 4, the radius of the inscribed sphere 1
     99 * 6 the size of the parallelepiped: 3 × 3 × 4, the radius of the inscribed sphere 1.5
    100 
    101 It is most profitable to take only the first stone.