Ben and Students
CodeChefOpen on judge ↗
Ben is an excellent teacher who joins a new school to teach programming. In his new class, there are N students. After the first few days of class, he finds out that not everyone is friends with everyone else in the class. To be exact he writes down M different friendships that he found in the class. Each friendship defines two people u and v who are friends with each other. He also sees that if 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.
Sign in to chat with the tutor and save your progress.
Sign in to start