#ABC478D. 区间集合插入询问 / Range Set Insertion Query
区间集合插入询问 / Range Set Insertion Query
Problem Statement
There are sets . Initially, are all empty sets.
The following operation is performed times on these sets. In the -th operation , a triple of integers is given, and the operation below is performed.
- Add to .
For every , find the number of elements of after all operations are finished.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Output the number of elements of , the number of elements of the number of elements of after all operations are finished, in this order, separated by spaces.
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
After the five operations, the sets are $\lbrace2\rbrace,\lbrace1,2\rbrace,\lbrace1,2,3\rbrace,\lbrace1,2,3\rbrace,\lbrace1,2,3\rbrace,\lbrace3\rbrace,\lbrace1\rbrace,\lbrace1\rbrace$, respectively. Thus, output their numbers of elements, , in this order, separated by spaces.
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
- Source: AtCoder ABC 478 D
相关
在下列比赛中: