The minions are very elitist in nature.
If minion x admires minion y, then y thinks too high of himself and does not admire x
back.Also, if x admires y, x also admires everyone that y admires. All minions are going
to be present at the “Villain Con”.The minions wanted to make sure that they do not
wear dress of same color as someone who admires them.
Given who admires whom Gru (Minion’s Master) thought of finding the minimum
number of different colored dresses that minions will be seen.
1st Line Contains T number of test cases
The next line contains the number of minions (N) and the number of relations the
minions will have (M).
Next M lines will contain Xi and Yi separated with space
i.e. Yi admires Xi
Minimum no. Of different colored dresses
T ≤ 10
0 ≤ N ≤ 100000
1 ≤ M ≤ 2*100000
1<= Xi,Yi <= N
1, 3, and 5 cannot wear the same dress. so the count is 3
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.