← All problemsSign in

Weak in the Middle

CodeChefRating 2476Open on judge ↗

You are given an array $A$ with length $N$. On each day, the following process was performed: - a new array $R$ is created; this array contains all elements $A_i$ such that $i=1$, $i=N$ or $\mathop{\rm min}(A_{i-1}, A_{i+1}) \le A_i$ ($2 \le i \lt N$), in the original order - $A$ is replaced by $R$ and $N$ is replaced by the length of $R$ In other words, all elements of $A$ that are between t

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