Friendship
CodeChefOpen on judge ↗
Tanuj organize a party where there are $N$ friends of 1 to N. Now you have to work on some queries. There are two types of queries that you need to handle. - $add$ $A$ $B$ : Here A and B are the integers which means that A and B become friends. - $find$ $A$ $B$ : Here A and B are the integers. For second type of query, you have to tell whether this two-person is a friend or not. If they are
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