← All problemsSign in

Black and White

You are given an **simple, undirected, connected** graph with $\textbf{n}$ nodes (numbered from $1$ to $n$) and $\textbf{m}$ edges, with each node coloured either black or white. There are a total $\textbf{b}$ black nodes. All edges in the graph have weight = 1. A node is called $\textbf{magical}$ if it is a $\textbf{white node}$ and $\textbf{each black node}$ is at atmost $\textbf{k}$ distance f

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