← All problemsSign in

Bipartite Graph from Trees

You are given a rooted tree T with N vertices. The vertices are numbered from 1 to N, and vertex 1 is the root. You are also given M lists A1, A2, .., AM, where each Ai contains a subset of the vertices in T. Consider a new bipartite graph G = (L, R, E), where L = {l1, l2, .., lM} and R = {r1, r2, .., rN} denote the two bi-partitions of the vertex set and E = { (li, rj), such that there exists a

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