← All problemsSign in

F - Non Unique

You are given an array $a$ of length $n$. Let $f(a, i)$ denote the number of indices $j$ such that $1 \le j < i$ and $a_j > a_i$. Let $F(a)$ be the set of indices $i$ having the maximum value of $f(a, i)$. You do not want $F(a)$ to consist of only one element, so you may perform the following operation any number of times: - Select an index $i$ ($1 \le i < n$), and swap $a_i$ and $a_{i + 1}

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