PDP-26 (2014) - Phase B' Senior High School (solar)

View as PDF

Submit solution

Points: 20 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem types
Allowed languages
C, C++, Java, Pascal, Python

Solar Wind

Solar wind is the flow of particles, mainly protons, emitted from the outer "atmosphere" of the Sun, the solar corona. As proven by the Voyager I spacecraft, these particles extend to the outskirts of our solar system. On Earth, solar wind has a significant impact on the structure of the ionosphere, communications, and meteorological changes. Since the beginning of the space age in 1960, with early satellites and minimal memory availability (a few hundred bytes), humanity has sought to study it. Devices of incredible intelligence were developed to record solar wind, requiring compression of the recorded information. The primary idea was to calculate the slope of the curve of variation and compress it into memory. To achieve this, and given the many fluctuations in the phenomenon, finding points of smooth change is crucial. These points are those for which all preceding values are smaller, and all subsequent values are larger.

Problem

Write a program in one of the IOI languages that, given a sequence of N integers, finds the term of the sequence for which all of its predecessors are smaller, and all of its successors are larger. If there are multiple such terms, print the largest one. If none exists, print the message "NOT FOUND."

Input Files

The input files named solar.in are text files structured as follows: The first line contains an integer N\;(1 \le N \le 1.000.000). Following are N lines with the values of solar wind, integers K\;(0 \le K \le 1.000.000).

Output Files

The output files named solar.out are text files with the following structure: They have a single line containing either an integer M, the largest term in the sequence for which all predecessors are smaller and all successors are larger, or, in case no such term exists, the string "NOT FOUND."

Examples of Input - Output Files
1st

STDIN (solar.in)

10
3
2
4
1
5
7
8
9
10
8

STDOUT (solar.out)

7
2nd

STDIN (solar.in)

10
4
9
8
5
6
5
4
3
2
1

STDOUT (solar.out)

NOT FOUND

Maximum Execution Time: 1 sec


Comments

There are no comments at the moment.