← All problemsSign in

Min-Fund Country

CodeChefRating 2763Open on judge ↗

There is a country which has $n$ houses and $m$ bi-directional roads between these houses, where the $i^{th}$ road connects house $u_i$ to $v_i$. A subset of these houses $S$ is called a *city* if any house in $S$ is reachable from any other house in $S$. Formally, a subset of houses $S$ is a city if $x$ and $y$ are reachable from each other for all $x, y \in S$. The funding required for a city $S

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