Minimum Sum
CodeChefOpen on judge ↗
Alice has the following permutation A of integers from 1 to N, $(a_1, a_2,..., a_N)$. She wants to find sum of minimum values over all subarrays of A. i.e. find $\sum_{l=1}^{l=N}{\sum_{r=l}^{r=N}{min(a_l,a_{l+1},...,a_r)}}$ ###Input: - First line contains an integer N, the size of array A. - The second line consists of N space seperated integers denoting $(a_1,a_2,...,a_n)$ - $(a_1,a_2,...
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start