#P8299. [COCI 2012/2013 #2] INFORMACIJE
[COCI 2012/2013 #2] INFORMACIJE
Background
The score for this problem follows the original COCI settings, with a full score of .
Problem Description
Mirko is very bored, so he picks up a sheet of paper and writes down a sequence with elements, where every positive integer from to appears exactly once. Then, he takes another sheet of paper and writes down statements about .
Each statement has one of two forms:
-
1 x y v: The maximum number in the interval is . -
2 x y v: The minimum number in the interval is .
After that, Slavko comes and steals Mirko's first sheet of paper. Mirko feels hopeless, and he wants you to find a sequence that satisfies these statements. It does not need to be exactly the same as the original sequence.
Input Format
The first line contains two integers , representing the length of the sequence and the number of statements.
The next lines each contain one statement.
Output Format
Output exactly one line: a length- sequence that satisfies all statements, where each of to appears exactly once, separated by spaces. If there is no solution, output .
3 2
1 1 1 1
2 2 2 2
1 2 3
4 2
1 1 1 1
2 3 4 1
-1
5 2
1 2 3 3
2 4 5 4
1 2 3 4 5
Hint
Translated by ChatGPT 5