Problem Link : FIRESC Problem - CodeChef
My Logic:For calculating maximum number of escape roots, i am calculating total number of disconnected componenets through DFS and ways of selecting group leader will be product of size of each connected components.
Solution Link: Online Compiler and IDE - GeeksforGeeks
Thanks in Advance!!