<PREV Problem:
NEXT>
Solved by 900 users: ...
UserDateAttemptTimeCMSC
V.A.KeRneL12 feb 2007Ruby1100.0253 
V.A.KeRneL12 feb 2007Ruby1000.0258 
V.A.KeRneL10 feb 2007Ruby800.0270 
V.A.KeRneL10 feb 2007Ruby900.0270 
sb3ar18 apr 2007Ruby400.0370 
sb3ar17 apr 2007Ruby300.0374 
V.A.KeRneL06 feb 2007Ruby400.0278 
extremeplay10 nov 2014Ruby500.0285 
sb3ar17 apr 2007Ruby200.0390 
Nakilon20 feb 2010Ruby300.0294 
sb3ar11 jan 2008Ruby800.0296 
kronos13 dec 2010Ruby1100.0298 
StarWorm08 jun 2009Python400.0998 
vi00228 apr 2007Ruby1300.02101 
kronos13 dec 2010Ruby1000.02102 
sb3ar23 dec 2007Ruby600.02105 
kronos13 sep 2009Ruby900.02105 
kronos01 jul 2007Ruby800.02108 
bush29 mar 2006Ruby300.02110 
DAV25 jun 2009C++500.02110 
e2n28 sep 2008Python200.07110 
kronos26 apr 2007Ruby500.02111 
DAV04 jun 2009C++200.02120 
Languages
C++
417
FPC
241
C
135
Java
56
Kylix
45
Ruby
13
Python
5
Perl
3
Lua
1
Scheme
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Max product

Time limit = 5 seconds

You are given N integer numbers. Choose thee of them which give maximum product.

Input. The first line contains N (3 ≤ N ≤ 106). Then N integer numbers follow. Absolute value of each number less than 30000.

Output Output the numbers in any order. If there are several soulutions output one of them.

Input#1
9
3 5 1 7 9 0 9 -3 10
Output#1
9 10 9

Input#2
3
-5 -30000 -12
Output#2
 -5 -30000 -12

Author:
Moscow school contest, 2004

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 180ms

SW soft NIX
ID = 100.26.179.196