#K5491. Bitonic Sequence Checker
Bitonic Sequence Checker
Bitonic Sequence Checker
A sequence (a_1, a_2, \ldots, a_n) is called a bitonic sequence if there exists an index (k) (with (1 < k < n)) such that:
[ a_1 < a_2 < \cdots < a_k \quad \text{and} \quad a_k > a_{k+1} > \cdots > a_n ]
In other words, the sequence first strictly increases and then strictly decreases. Note that sequences with less than three elements are not considered bitonic. Given a sequence of integers, determine whether it is bitonic. This problem is classified as easy.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n) denoting the number of elements in the sequence. The second line contains (n) space-separated integers representing the sequence.
outputFormat
Output a single line to standard output (stdout) containing either 'True' if the sequence is bitonic or 'False' otherwise.## sample
6
1 3 8 12 4 2
True