← All problemsSign in

Random Coloring

CodeChefRating 3550Open on judge ↗

Given an undirected graph $G$ with $N$ nodes, where every node is initially uncolored, Chef colors its vertices either red or blue by the following process: - Chef will perform exactly $N$ coloring operations, one for each vertex. - At the time of the $i$-th operation, let $R$ denote the number of red nodes and $B$ denote the number of blue nodes. Chef colors node $i$ red with a probability of $

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