#Lutece3124. 尽力局

尽力局

Migrated from Lutece 3124 尽力局

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Tag:CDQ分治

队伍的比赛成绩很不好,若只兔头教练准备好好评估队员的实力。

现在队伍里共有 nn 位选手,为了便于量化实力,第 ii 位选手有 ai,bi,cia_i,b_i, c_i 三个属性,当选手 AA 的三项属性都不小于另一位选手 BB 时,我们称 AA 能胜过 BB(五五开?五五开也是赢!)选手 AA 的巅峰值即他能胜过的选手数。

现在若只教练希望能统计处于各个巅峰值的选手个数,由于工头不可抗力的影响,这个艰巨的任务就交给你了!

简单来说: 设 f(i)f(i) 表示同时满足 ajai,bjbi,cjcia_j \le a_i,b_j\le b_i,c_j\le c_ijij\neq ijj 的数量。 对于 d[0,n)d\in[0,n),求 f(i)=df(i)=d 的数量。

Input

第一行两个整数 n,kn, k1n,k2×1051 \le n,k\le 2\times 10^5)表示队员数量和最大属性值。

接下来 nn 行,每行三个整数 ai,bi,cia_i , b_i , c_i1ai,bi,cik2×1051 \le a_i,b_i,c_i\le k \le 2\times 10^5)分别表示三个属性值。

Output

输出 nn 行,每行为 f(i)=df(i)=d 的数量。

Samples

10 3
3 3 3
2 3 3
2 3 1
3 1 1
3 1 2
1 3 1
1 1 2
1 2 2
1 3 2
1 2 1
3
1
3
0
1
0
1
0
0
1

Resources

2024 UESTC ICPC Training for Data Structure