← All problemsSign in

Yet Another Easy Problem

You are given an array $A$ of $N$ positive integers. In one step you should choose an index $i$ ($0 \leq i \leq N - 1$) with the largest positive number in the array (if there are several indices choose any) and reduce $A_i$ by 1. You should repeat this until the array contains no positive integer. Figure out if this is possible in such a way that you **don't choose the same $i$ twice in a row**.

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