http://www.elijahqi.win/archives/1178
We’ll call an array of n non-negative integers a[1], a[2], …, a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≤ li ≤ ri ≤ n) meaning that value should be equal to qi.
Your task is to find any interesting array of n elements or state that such array doesn’t exist.
Expression x&y means the bitwise AND of numbers x and y. In programming languages C++, Java and Python this operation is represented as “&”, in Pascal — as “and”.
Input
The first line contains two integers n, m (1 ≤ n ≤ 105, 1 ≤ m ≤ 105) — the number of elements in the array and the number of limits.
Each of the next m lines contains three integers li, ri, qi (1 ≤ li ≤ ri ≤ n, 0 ≤ qi < 230) describing the i-th limit.
Output
If the interesting array exists, in the first line print “YES” (without the quotes) and in the second line print n integers a[1], a[2], …, a[n] (0 ≤ a[i] < 230) decribing the interesting array. If there are multiple answers, print any of them.
If the interesting array doesn’t exist, print “NO” (without the quotes) in the single line.
Examples
Input
3 1
1 3 3
Output
YES
3 3 3
Input
3 2
1 3 3
1 3 2
Output
NO
线段树+位运算。。有趣
题意:每次都会给一个区间的&的值 给出m个区间的&的值,询问是否冲突
要是不冲突 给出一种可能的解
每个区间&的值 不妨我们直接把这个值给进去,反正一定至少是这个值
然后我每次对区间操作的时候我都用 |运算 把这位要求的1添加进去 使这个区间的&运算值满足条件
每次检查的时候如果查询的&运算值和我给的不同 那么就无法满足题目 退出