Problem E
Námsleið
Languages
en
is
The semester is coming to an end so it is time to plan your studies and choose courses for the next semester. Oh no! This list is so confusing! Each course has so many prerequisites! With such a chaotic layout, is it even possible to sign up for and complete all the courses in any number of semesters?
You may take as many courses as you wish each semester and you may finish your studies in as many semesters as you wish, but you should try to minimize the number of semesters. You may only sign up for courses for which you have finished all prerequisites. Since you are a stellar student, you pass all courses for which you sign up.
Input
The first line of input consists of one integer
Output
If it is impossible to finish all the courses, simply output
one line with the text Omogulegt!.
Otherwise, output a line with the text Mogulegt! followed by a line containing a
positive integer
If there are multiple solutions, you may output any of them.
Scoring
In the table below, let
.
Group |
Points |
Constraints |
1 |
20 |
|
2 |
20 |
|
3 |
10 |
|
4 |
20 |
|
5 |
20 |
|
6 |
10 |
|
Sample Input 1 | Sample Output 1 |
---|---|
1 1 1 |
Omogulegt! |
Sample Input 2 | Sample Output 2 |
---|---|
3 0 0 2 1 2 |
Mogulegt! 2 2 1 2 1 3 |
Sample Input 3 | Sample Output 3 |
---|---|
3 1 3 1 1 1 2 |
Omogulegt! |
Sample Input 4 | Sample Output 4 |
---|---|
12 0 0 0 0 1 1 1 3 1 1 1 1 0 0 1 5 2 1 4 |
Mogulegt! 3 4 3 4 1 2 4 8 7 6 5 4 9 10 11 12 |