The school cafeteria
A group of children stand in a straight line, one behind the other, waiting for their turn at the school cafeteria. The first child obviously sees the entrance of the cafeteria, but for the children standing behind, it may not be certain if they can see it too. For a child to see the entrance of the cafeteria, all the children standing in front of them must be shorter than them.
Problem
Develop a program in one of the IOI languages that, after reading a file containing the heights of children, will print how many children see the entrance.
Input Files:
The input file (xxx.in) is a text file that contains only two lines. The first line contains an integer : the number of children standing in line. The second line contains integers, separated in pairs by a space. These numbers represent the heights of the children, given in the order they stand in line, from the back to the front. In other words, the first number on the second line is the height of the last child (the one farthest from the entrance of the cafeteria), and the last number is the height of the first child (the one closest to the entrance).
Output Files:
The output file (xxx.out) is a text file with the following format: It has only one line containing a single integer : the number of children who can see the entrance of the cafeteria.
Examples of Input - Output Files:
1st
STDIN (xxx.in)
7
5 6 4 6 3 4 1
STDOUT (xxx.out)
3
2nd
STDIN (xxx.in)
4
23 17 7 42
STDOUT (xxx.out)
1
Constraints:
1 1.000.000
Maximum execution time: 1sec.
Maximum available memory: 64MB.
Comments