区间集合插入查询AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)There are $N$ sets $S _ 1,S _ 2,\ldots,S _ N$. Initially, $S _ 1,S _ 2,\ldots,S _ N$ are all empty sets.
有 $N$ 个集合 $S _ 1,S _ 2,\ldots,S _ N$。初始时,$S _ 1,S _ 2,\ldots,S _ N$ 均为空集。AI (CI翻译)
The following operation is performed $Q$ times on these sets. In the $i$-th operation $(1\le i\le Q)$, a triple of integers $(L _ i,R _ i,X _ i)$ is given, and the operation below is performed.
对这些集合进行 $Q$ 次操作。第 $i$ 次操作 $(1\le i\le Q)$ 给定一个整数三元组 $(L _ i,R _ i,X _ i)$,并执行以下操作:AI (CI翻译)
- Add
$X _ i$to$S _ {L _ i},S _ {L _ i+1},\ldots,S _ {R _ i}$.
- 将
$X _ i$添加到$S _ {L _ i},S _ {L _ i+1},\ldots,S _ {R _ i}$中。
For every $i=1,2,\ldots,N$, find the number of elements of $S _ i$ after all operations are finished.
对于每个 $i=1,2,\ldots,N$,求所有操作完成后 $S _ i$ 中元素的个数。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1\le N\le2\times10 ^ 5$$1\le Q\le2\times10 ^ 5$$1\le L _ i\le R _ i\le N\ (1\le i\le Q)$$1\le X _ i\le Q\ (1\le i\le Q)$- All input values are integers.
$1\le N\le2\times10 ^ 5$$1\le Q\le2\times10 ^ 5$$1\le L _ i\le R _ i\le N\ (1\le i\le Q)$$1\le X _ i\le Q\ (1\le i\le Q)$- 输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入按以下格式给出:AI (CI翻译)
N Q
L _ 1 R _ 1 X _ 1
L _ 2 R _ 2 X _ 2
\vdots
L _ Q R _ Q X _ Q
N Q
L _ 1 R _ 1 X _ 1
L _ 2 R _ 2 X _ 2
\vdots
L _ Q R _ Q X _ QAI (CI翻译)
Output
输出格式
AI (CI翻译)Output the number of elements of $S _ 1 the number of elements of $$,$ the number of elements of $S _ 2$$,\ldots,$$S _ N$ after all $Q$ operations are finished, in this order, separated by spaces.
按顺序输出所有 $Q$ 次操作完成后 $S _ 1 $$,$ $S _ 2$$,\ldots,$$S _ N$ 中元素的个数,并以空格分隔。AI (CI翻译)
样例
8 5
2 5 1
1 4 2
7 8 1
3 6 3
2 5 2
1 2 3 3 3 1 1 1
30 20
3 22 11
8 30 10
12 14 7
2 17 4
1 19 12
7 30 15
11 23 2
14 25 17
9 12 7
10 16 7
16 18 19
1 11 14
11 15 4
1 21 6
4 8 10
23 24 11
8 27 10
1 19 12
23 23 16
13 24 12
3 4 5 6 6 6 7 7 8 8 9 8 8 9 9 10 9 8 7 7 7 6 7 5 3 2 2 2 2 2
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。