← All problemsSign in

Prefix Max

CodeChefRating 3097Open on judge ↗

Consider an array $B$ of length $M$. We define the *prefix maximum array* of array $B$, $F(B)$, as an array $C$ of length $M$ such that $C_i=\max(B_1, B_2, \ldots B_i)$. Stack had a permutation $P$ of length $2 \cdot N$. He deleted the last $N$ elements from $P$ to obtain an array $P$ of size $N$. Stack performs the following step for **all** permutations $Q$ of length $2 \cdot N$ : - Check

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start