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

Hallo

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $a$ consisting of $n$ elements. The value of a contiguous subarray $a[l...r]$ is defined as $\text{min}(a_l, a_r) \times (r - l - 1)$. Find the maximum value of any contiguous subarray of the array $a$. ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $a_i$. ### Output - Print a single integer representing the maximum value of any contiguous subarray. ### Constraints - $1 \leq n \leq 5 \times 10^5$. - $1 \leq a_i \leq 10^9$. ### Example Input: ``` 4 1 4 2 5 ``` Output: ``` 4 ```
misc
Hallo
Truy vấn ước bội
Thay đổi số
Đường đi lớn nhất
Tổng toàn bộ
LIS
Chim
Topic
Two pointers
Greedy
Rating 1600
Solution (0) Solution