Processing math: 100%
Within 2 - MarisaOJ: Marisa Online Judge

Within 2

Time limit: 1000 ms
Memory limit: 256 MB
Given n line segments lying on the number line, the i-th segment starts from li and ends at ri. Segment j is said to be within segment i if li≤lj≤rj≤ri. For each segment, count the number of line segments within it (excluding itself). ### Input - The first line contains an integer n. - The next n lines, each line contains two integers li and ri. ### Output - Print n integers, where the i-th integer represents the number of line segments within the i-th segment. ### Constraints - 1≤n≤105. - 1≤li≤ri≤105. ### Example Input 423468824 Output 0001