SP18287 IITWPC4K - Maggu and Magguness Level
Description
Until now you would have known that Maggu is a big geek. His class has n students. All the students are geeks like him. You are given m informations of form a, b which denotes that a th guy is less geeky than b th guy (geekiness(a) < geekiness (b)). Note that geekiness of each person is unique and can be from 1 to n. Now Maggu wonders what are the possible values of his geekiness. If such a distribution of geekiness value is not possible, then output -1.
Input Format
First line contains T: number of test cases (1
Output Format
For each test case, You have to output one or two lines depending on the situation. In the former case, If the disribution of geekiness can not exist, output -1.
In the second case (ie two lines), In the first line, output a single integer number of possible geekiness values of Maggu.
Then in the next line output in the increasing order all the possible geekiness values of Maggu in ascending order. All the values should be space seperated.