← All problemsSign in

Chandelier

CodeChefRating 2368Open on judge ↗

A linear chandelier is held up by $N$ supports. The $i^{th}$ support initially holds up a weight $W_i$, and will collapse if the weight on it is **more than or equal to** $A_i$. Note that initially, $W_i \lt A_i$ for all $1 \le i \le N$. Whenever $W_i\ge A_i$ for some support, the following happens: - The $i^{th}$ support is destroyed; - Let $x$ and $y$ be uniformly random non-negative integers

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