Polish version    English version  
  History of OI -> VI OI 1998/1999 -> Problems


 News
 About Olympic
 History of OI
XVII OI 2009/2010
XVI OI 2008/2009
XV OI 2007/2008
XIV OI 2006/2007
XIII OI 2005/2006
XII OI 2004/2005
XI OI 2003/2004
X OI 2002/2003
IX OI 2001/2002
VIII OI 2000/2001
VII OI 1999/2000
VI OI 1998/1999
Stage III - results
Stage II - results
Stage I - results
Problems
Regulations
Organization
Hints
Schedule
Stats
V OI 1997/1998
IV OI 1996/1997
III OI 1995/1996
II OI 1994/1995
I OI 1993/1994
 OI books
 National team
 Olympic camps
 Photo gallery
 Links
 SIO
 MAIN
Niebieskie ksi.eczki
VI Olimpiada Informatyczna 1998/1999

Task: PUS
Author:
Empty cuboids

I stage contest  

We call a cuboid regular if:

  • one of its vertices is a point with coordinates (0,0,0),
  • edges beginning in this vertex lay on positive semi-axes of the coordinate system,
  • the edges are not longer than 106

There is given a set A of points of space, which coordinates are integers from the interval [1..106]. We try to find a regular cuboid of maximal volume, which does not contain any of the points from the set A. A point belongs to the cuboid if it belongs to the inside of the cuboid, i.e. it is a point of the cuboid, but not of its wall.

Task

Write a program which: 

  • reads from the text file PUS.IN coordinates of points from the set A,
  • finds one of the regular cuboids of maximal volume, which does not contain any points from the set A,
  • writes the result in the output file PUS.OUT.

Input

In the first line of the input file PUS.IN one non-negative integer n, n <= 5000, is written. It is the number of elements in the set A. In the following n lines of the file PUS.IN there are triples of integers from the interval [1..106], which are coordinates (respectively x, y and z) of points from A. Numbers in each line are separated by single spaces.

Output

In the only line of the output file PUS.OUT there should be three integers separated by single spaces. These are coordinates (respectively x, y and z) of the vertex of the regular cuboid of maximal volume. We require that coordinates are positive.

Example

For the input file PUS.IN:

4
3 3 300000
2 200000 5
90000 3 2000
2 2 1000

the correct answer is the file PUS.OUT:

1000000 200000 1000

Your program should look for the file PUS.IN in the current directory and produce the output file PUS.OUT in current directory too. The file containing source code of your program should have a name PUS.???, whereas you should put three-letter abbreviation of used programming language name instead of ???. The same program in executable form should be written in the file PUS.EXE




Print friendly version