report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Bitonic sequence - MarisaOJ: Marisa Online Judge

Bitonic sequence

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ consisting of $n$ integer elements, check if $A$ is a bitonic sequence. A sequence is called a bitonic sequence if there exists an index $i$ such that: - For all $j < i$, $A_j < A_{j + 1}$. - For all $j > i$, $A_j < A_{j-1}$. ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $A_i$. ### Output - If $A$ is a bitonic sequence, print YES, otherwise print NO. ### Constraints - $1 \le n \le 10^5$. - $1 \le A_i \le 10^9$. ### Example Input: ``` 4 1 4 10 2 ``` Output: ``` YES ```
Array
Even elements
Smallest value
Average
Array reversal
Negative and positive
Consecutive differences
Largest value
Positive and negative
Dominant element
Second largest
Maximum product
Array rotation
Palindrome array
Circle
Insert
Positive subarray
Sorting
Similar Arrays
Unique
Unique 2
Frequent value
Most Frequent Value
Bitonic sequence
Swap
Topic
Basic
Rating 800
Solution (0) Solution