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

Peak Product

Time limit: 1000 ms
Memory limit: 256 MB
Consider an array $A$ consisting of $n$ integers. We define the function $f(l,r)$ as follows: $$f(l,r) = (r - l + 1) \times min(A_l,A_{l+1},...,A_r)$$ Our goal is to find the maximum value of $f(l,r)$ with $1 \leq l \leq r \leq n$. ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $A_i$. ### Output - Print an integer is the maximum possible $f(l,r)$. ### Constraints - $1 \le n \le 10^5$. - $1 \le A_i \le 10^9$. ### Example Input: ``` 3 1 2 3 ``` Output: ``` 4 ```
Monotonic queue
Nearest position
Subarray minimum
Peak Product
Histogram
Maximum subsequence value
Deleting digits
Electric poles
Planting flowers
Ring road
Prefix minimum
Knee surgery
Topic
Data structure
Rating 1400
Solution (0) Solution