cswork / OA打开练习工作台

CrusoeOA #1

Interval Usage with Non-Overlapping Overrides

估计中等可在线判题

考点(AI 标注)前缀和区间模拟/实现

Intervals with usage=1 are unioned; usage=0 does not clear anything; non-overlapping override intervals overwrite the usage result.

This site's standard input/output format and supplementary bounds follow this problem's description.

输入格式

The input is D and U, followed by U lines l r v; then O, followed by O lines l r v. 1≤D≤2×10^5, U,O≤2×10^5; intervals are closed and lie within [1,D], v∈{0,1}; override intervals are pairwise non-overlapping.

输出格式

Output a 0/1 string of length D.

样例 1

输入:

10
2
1 2 1
4 10 1
1
2 4 0

输出:

1000111111

样例 2

输入:

3
1
1 3 0
0

输出:

000

样例 3

输入:

1
5
1 1 1
1 1 0
1 1 0
1 1 0
1 1 0
1
1 1 1

输出:

1