Codeforces Round 275 (Div. 1)
B
Interesting Array
Codeforces
1800
原题
← AC →
翻译中…

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 $*l*_{*i*}$, $*r*_{*i*}$, $*q*_{*i*}$ ($1 ≤ *l*_{*i*} ≤ *r*_{*i*} ≤ *n*$) meaning that value image should be equal to $*q*_{*i*}$.

翻译中…

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* ≤ 10^{5}$, $1 ≤ *m* ≤ 10^{5}$) — the number of elements in the array and the number of limits.

翻译中…

Each of the next $*m*$ lines contains three integers $*l*_{*i*}$, $*r*_{*i*}$, $*q*_{*i*}$ ($1 ≤ *l*_{*i*} ≤ *r*_{*i*} ≤ *n*$, $0 ≤ *q*_{*i*} < 2^{30}$) 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*] < 2^{30}$) 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.

翻译中…

样例

Input #1
3 1
1 3 3
Output #1
YES
3 3 3
InputCopy OutputCopy
Input #2
3 2
1 3 3
1 3 2
Output #2
NO
InputCopy OutputCopy
题目信息
题号
482B
时间限制
1 s
内存限制
256 MB
标签
构造
数据结构
树

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。