jujutsu sorcerers are on a battlefield which can be represented by a line with
regions. Each sorcerer uses their domain expansion, with the
sorcerer's domain expansion covering and controlling all regions from
to
, inclusive, and having strength
. It is guaranteed that no two sorcerer's domain expansions have the same strength. If a region is covered by two or more domain expansions, it will be controlled by the strongest one.
How many regions are controlled by each jujutsu sorcerer's domain expansion?
Constraints
All values of are unique.
Subtask 1 [2/15]
Subtask 2 [4/15]
Subtask 3 [4/15]
Subtask 4 [5/15]
No additional constraints.
Input Specification
The first line of input contains and
, representing the number of people and the number of regions.
The next lines of input each contain
, representing the range covered by the
sorcerer's domain expansion and its strength.
Output Specification
Output space separated integers, with the
integer representing how many regions the
sorcerer's domain expansion controls.
Sample Input 1
2 5
1 3 1
3 5 2
Sample Output 1
2 3
Explanation for Sample Output 1
The first sorcerer's domain expansion covers regions . The second sorcerer's domain expansion covers regions
. Region
is controlled by the second sorcerer's domain expansion as it is stronger.
Sample Input 2
4 10
1 5 1
1 1 100
3 4 2
7 10 3
Sample Output 2
2 1 2 4
Comments