Antimatching
Vasya's older brother, Petya, attends an algorithm course in his school. Today he learned about matchings in graphs. Formally, a set of edges in a graph is called a *matching* if no pair of distinct edges in the set shares a common endpoint. Petya instantly came up with an inverse concept, an *antimatching*. In an antimatching, **any** pair of distinct edges should have a common endpoint. Petya
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.
Sign in to chat with the tutor and save your progress.
Sign in to start