Beauty and The Array
CodeChefOpen on judge ↗
Let’s define a function score: $$Score(p[1...m], q[1...m]) = \sum_{i = 1}^{m} (m - i + 1) * p[i] + q[i]$$ Let’s define Beauty of an array: $$Beauty(p[1...n], q[1...n]) = max_{1 \le i \le j \le n} Score(p[i...j], q[i...j])$$ Here $p[i...j]$ means sub-array of $p$ starting from $i$-th position and ending at $j$-th position. You are given two arrays $A$ and $B$ of $n$ integers. You can do the foll
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