← All problemsSign in

Expected Components

CodeChefRating 3071Open on judge ↗

You are given a tree with $N$ vertices (i.e, a simple undirected connected graph with $N-1$ edges). $K$ of its vertices are colored black, and the other vertices are white. For every $x$ from $1$ to $K$, solve the following problem: - Find the expected number of connected components in the resulting graph, if you delete *exactly* $x$ randomly chosen black vertices from the tree. Each subset of $x

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