AtCoder Beginner Contest 216
翻译中…
Problem Statement
翻译中…
Consider a sequence of length $N$ consisting of 0s and 1s, $A=(A_1,A_2,\dots,A_N)$, that satisfies the following condition.
翻译中…
For every
$i=1,2,\dots,M$, there are at least$X_i$occurrences of1among$A_{L_i}, A_{L_i+1}, \dots, A_{R_i}$.
翻译中…
Print one such sequence with the fewest number of occurrences of 1s.
翻译中…
There always exists a sequence that satisfies the condition under the Constraints.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 2 \times 10^5$$1 \leq M \leq \min(2 \times 10^5, \frac{N(N+1)}{2} )$$1 \leq L_i \leq R_i \leq N$$1 \leq X_i \leq R_i-L_i+1$$(L_i,R_i) \neq (L_j,R_j)$if$i \neq j$.- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N M
L_1 R_1 X_1
L_2 R_2 X_2
\vdots
L_M R_M X_M
翻译中…
Output
翻译中…
Print a sequence $A$ consisting of 0s and 1s, with spaces in between.
翻译中…
A_1 A_2 \dots A_N
翻译中…
It must satisfy all the requirements above.
翻译中…
样例
Input #1
6 3
1 4 3
2 2 1
4 6 2
Output #1
0 1 1 1 0 1
Another acceptable output is `1 1 0 1 1 0`.
On the other hand, `0 1 1 1 1 1`, which has more than the fewest number of `1`s, is unacceptable.
Input #2
8 2
2 6 1
3 5 3
Output #2
0 0 1 1 1 0 0 0
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。