Equal Number of Prefix Maximums
CodeChefOpen on judge ↗
For an array $[B_1, B_2, \ldots, B_K]$ of distinct integers, let's define its **weight** as the number of its prefix maximums $-$ that is, of such indexes $i$, that $B_i>B_j$ for all $1 \le j < i$. You are given a permutation $[P_1, P_2, \ldots, P_N]$ of integers from $1$ to $N$. Determine if it's possible to split it into two nonempty subsequences with equal weights. ### Input - The first line
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