← All problemsSign in

Balance Difficulties

CodeChefRating 2157Open on judge ↗

Suppose a contest has $N$ problems, with difficulties $A_1, A_2, ..., A_N$, and we have a parameter $X$. The contest is said to be balanced if and only if the following conditions hold : - $A_i \ge A_{i - 1}$ for all $2 \le i \le N$, i.e. the problems are sorted in difficulty order. - $A_i - A_{i - 1} \le X$ for all $2 \le i \le N$, i.e. the difficulties between $2$ adjacent problems differ by a

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