Friends and Snakes
CodeChefOpen on judge ↗
You are given a graph with $n$ nodes and $m$ edges. Each node represents a person and each edge represents a friendship betweent two persons. You are the person with index 1. If at least half of a person A's friends break their friendship with A, A breaks his friendship with all of his friends. (Mean, we know.) Person $p$ has broken friendship with all of his friends. A chain reaction might
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