Gettin WA in DISHOWN

dishown
disjoint-set
union-find

#1

Pls help in letting me know what are the test cases on which my code fails in the practice(easy)DISHOWN. I have tried all possible test cases… Pls help :frowning:
Here is my code https://www.codechef.com/viewsolution/8892158


#2

When you are checking this: else if(s[x-1]<s[y-1])
d.union(parent,x,y);
x-1 th dish may already be taken by some other chef, so take the parent of x-1 and the parent of y-1. Have a look at my code if you want.

https://www.codechef.com/viewsolution/8900500