Fixed Weight
A permutation of length $N$ is an array of $N$ integers $(P_1,P_2, \dots,P_N)$ where every integer from $1$ to $N$ (inclusive) appears in it exactly once. The weight of a subsegment containing the elements $(P_l,P_{l+1}, \dots,P_r)$ is defined as follows: $$W(l, r) = (r-l+1)\cdot \min\limits_{l\le i \le r} (P_i)$$ where $1\le l \le r \le N$ and $\min\limits_{l\le i \le r} (P_i)$ denotes the mini
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