内存限制:128 MB
时间限制:1 S
题面:传统
评测方式:Special Judge
上传者:
提交:4
通过:3
Ran loves intervals, inversions and trees, so she wants to make a problem mixing all of them together!
Ran has a unknown permutation p of length n and m pairwise distinic intervals, the i-th one is [li,ri][l_i,r_i][li,ri]. It's guaranteed that for two intervals iii and jjj, let li≤ljl_i\le l_jli≤lj (if li=ljl_i=l_jli=lj, let ri>rjr_i> r_jri>rj), then ri<ljr_i<l_jri<lj or ri≥rjr_i\ge r_jri≥rj always holds.
There will be mmm restrictions, the iii-th one is like the number of inversions in [li,ri][l_i,r_i][li,ri] must be odd/even. An inversion in an array aaa is a pair of indices (i,j)(i, j)(i,j) such that i>ji > ji>j and ai<aja_i < a_jai<aj.
Now Ran want you to construct a permutation ppp and meet all restrictions, or report it is impossible.
Output −1-1−1 if it's impossible to construct ppp, or output nnn integers representing ppp.