#P3810. Dominated Triplets Count
Dominated Triplets Count
Dominated Triplets Count
Given n elements, where the i-th element has three integer attributes \(a_i\), \(b_i\), and \(c_i\). For each element \(i\), define:
[ f(i) = |{ j \mid a_j \le a_i,; b_j \le b_i,; c_j \le c_i, ; j \ne i }|, ]
Your task is to compute, for every \(d \in [0, n)\), the number of elements \(i\) such that \(f(i)=d\).
Note: The comparisons are performed component-wise. Elements with exactly the same attributes are considered, but when counting \(f(i)\), the element itself is not counted (i.e. \(j\neq i\)).
inputFormat
The first line contains a single integer \(n\) representing the number of elements.
Each of the next \(n\) lines contains three space-separated integers \(a_i\), \(b_i\), and \(c_i\) (\(1 \le i \le n\)).
outputFormat
Output \(n\) lines. The \(d\)-th line (starting from \(d=0\)) should contain a single integer, representing the number of elements \(i\) for which \(f(i)=d\).
sample
5
1 2 3
2 3 4
1 2 3
2 2 2
3 3 3
3
0
0
2
0
</p>