#P4871. Interesting Array

Interesting Array

Interesting Array

题面翻译

构建一个序列 aa,满足 mm 条限制。

限制形如 l,r,ql,r,q:$a _ l\ \&\ a _ {l+1}\ \& \cdots \&\ a _ {r-1}\ \&\ a _ r = q$;(此处 &\& 为位运算的 AND 操作).

1n,m105,0qi2301\le n,m\le 10^5,0\le q_i\le 2^{30}

由 @Styx 提供翻译

题目描述

We'll call an array of n n non-negative integers a\[1\],a\[2\],...,a\[n\] interesting, if it meets m m constraints. The i i -th of the m m constraints consists of three integers li l_{i} , ri r_{i} , qi q_{i} ( 1<=li<=ri<=n 1<=l_{i}<=r_{i}<=n ) meaning that value should be equal to qi q_{i} .

Your task is to find any interesting array of n n elements or state that such array doesn't exist.

Expression x&y means the bitwise AND of numbers x x and y y . In programming languages C++, Java and Python this operation is represented as "&", in Pascal — as "and".

输入格式

We'll call an array of n n non-negative integers a\[1\],a\[2\],...,a\[n\] interesting, if it meets m m constraints. The i i -th of the m m constraints consists of three integers li l_{i} , ri r_{i} , qi q_{i} ( 1<=li<=ri<=n 1<=l_{i}<=r_{i}<=n ) meaning that value should be equal to qi q_{i} .

Your task is to find any interesting array of n n elements or state that such array doesn't exist.

Expression x&y means the bitwise AND of numbers x x and y y . In programming languages C++, Java and Python this operation is represented as "&", in Pascal — as "and".

输出格式

We'll call an array of n n non-negative integers a\[1\],a\[2\],...,a\[n\] interesting, if it meets m m constraints. The i i -th of the m m constraints consists of three integers li l_{i} , ri r_{i} , qi q_{i} ( 1<=li<=ri<=n 1<=l_{i}<=r_{i}<=n ) meaning that value should be equal to qi q_{i} .

Your task is to find any interesting array of n n elements or state that such array doesn't exist.

Expression x&y means the bitwise AND of numbers x x and y y . In programming languages C++, Java and Python this operation is represented as "&", in Pascal — as "and".

样例 #1

样例输入 #1

3 1
1 3 3

样例输出 #1

YES
3 3 3

样例 #2

样例输入 #2

3 2
1 3 3
1 3 2

样例输出 #2

NO