← All problemsSign in

Expected Difference

CodeChefRating 2706Open on judge ↗

Alice initially had $X$ stones. She divides the $X$ stones into $N$ piles where the $i^{th}$ pile contains $A_i$ stones. Now, she randomly selects a subset of piles $S$ such that every subset has an **equal** probability of getting selected. After selecting the subset, for every $1 \le i \le N$, - If $i \in S$, Alice colours all the stones in the $i^{th}$ pile `RED`. - If $i \notin S$, Alice co

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