← All problemsSign in

Permutation Split

CodeChefRating 2996Open on judge ↗

For a sequence of positive integers $A_1, A_2, \ldots, A_K$, let's define the number of inversions in it as the number of pairs of integers $(i, j)$ such that $1 \le i \lt j \le K$ and $A_i \gt A_j$. You are given a permutation $P_1, P_2, \ldots, P_N$ of the integers $1$ through $N$. Determine if it is possible to partition this permutation into two subsequences (possibly empty or non-contiguou

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