← All problemsSign in

Enemies and Friends

It is well known that the enemy of my enemy is my friend... You are to find how many friends someone has following the above well known expression. Input format: The first line of each test file contains n p, where n is the number of people and p is the number of enemy relationships The p following line each contain an enemy relationship name1 name2 implying that name1 is the enemy of name2 (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