<PREV Problem:
NEXT>
Solved by 292 users: ...
UserDateAttemptTimeCMSC
sb3ar09 apr 2008Python1505.6546 
turb024 mar 2008Python705.3248 
turb026 jul 2008Python800.2750 
sb3ar09 apr 2008Python1400.3055 
bush25 aug 2007Ruby300.2363 
vitar04 apr 2010C++600.0468 
vitar04 apr 2010C++800.0468 
vitar04 apr 2010C++900.0468 
vitar04 apr 2010C++1100.0468 
fetetriste22 nov 2007C++800.0570 
vitar04 apr 2010C++1200.0472 
fetetriste21 may 2007C++600.0573 
turb030 dec 2007C++400.0277 
turb030 dec 2007C++300.0283 
a2zaruna14 jan 2007C++600.0483 
turb030 dec 2007C++200.0284 
sb3ar01 feb 2008Ruby900.2485 
lim0n19 apr 2011C++300.1186 
a2zaruna14 jan 2007C++300.0489 
sb3ar31 jan 2008Ruby800.2189 
blazej12 sep 2007C++100.0291 
HeaDacHe03 jan 2008C++100.0691 
Radi25 aug 2012C++100.0392 
Languages
C++
189
FPC
46
C
36
Kylix
20
Java
11
Ruby
4
Python
2
Perl
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

Pancake-week

Time limit = 2 second(s)

Petya has many friends. Today they visit him to eat his delicious pancakes (Petya has a talent for pancake-making). Petya put N frying pans one by one and cooked pancakes on each of them. Now he wants to serve up the pancakes for dinner. Petya can advance from first frying pan to second,from second to third ,..., from N-1 to N. Pancakes has different sizes, unfortunately, and Petya doesn't want to put them at a plate randomly. Viz. he wants to put them in a "hill-like" way: pancake K+1 must be smaller than pancake K. Obviously, Petya can hardly put all the pancakes in one pass. Your aim — to help him and find out the minimum number of passes, he can put all the pancakes.

Input First enter string contains number of the frying pans N (1 ≤ N ≤ 10000). Then follow N integers — radii of the pancakes R (0 ≤ R ≤ 65535).

Output Minimum number of the passes.

Input#1
3
1 1 1

Output#1
3

Input#2
5
5 4 3 2 1
Output#2
1

Input#3
19
7 19 32 15 71 94 33 4 26 11 89 75 16 31 54 95 27 2 14
Output#3
6

Author:
Classical task. Text and tests by Sergey Kuznetsov.

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


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

SW soft NIX
ID = 3.236.97.49