#P8299. [COCI 2012/2013 #2] INFORMACIJE

    ID: 9325 远端评测题 1000ms 32MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>图论2012Special JudgeCOCI(克罗地亚)

[COCI 2012/2013 #2] INFORMACIJE

Background

The score for this problem follows the original COCI settings, with a full score of 140140.

Problem Description

Mirko is very bored, so he picks up a sheet of paper and writes down a sequence AA with NN elements, where every positive integer from 11 to NN appears exactly once. Then, he takes another sheet of paper and writes down MM statements about AA.

Each statement has one of two forms:

  • 1 x y v: The maximum number in the interval [x,y][x, y] is vv.

  • 2 x y v: The minimum number in the interval [x,y][x, y] is vv.

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 N,M (1N200,0M4×104)N, M\ (1\le N\le 200, 0\le M\le 4\times 10^4), representing the length of the sequence and the number of statements.

The next MM lines each contain one statement.

Output Format

Output exactly one line: a length-NN sequence that satisfies all statements, where each of 11 to NN appears exactly once, separated by spaces. If there is no solution, output 1-1.

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