#551
Unrated
Convoluted Intervals
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

The cows are hard at work trying to invent interesting new games to play. One of their current endeavors involves a set of NN intervals (1N21051\le N\le 2\cdot 10^5), where the iith interval starts at position aia_i on the number line and ends at position biaib_i \geq a_i. Both aia_i and bib_i are integers in the range 0M0 \ldots M, where 1M50001 \leq M \leq 5000.

To play the game, Bessie chooses some interval (say, the iith interval) and her cousin Elsie chooses some interval (say, the jjth interval, possibly the same as Bessie's interval). Given some value kk, they win if ai+ajkbi+bja_i + a_j \leq k \leq b_i + b_j.

For every value of kk in the range 02M0 \ldots 2M, please count the number of ordered pairs (i,j)(i,j) for which Bessie and Elsie can win the game.

입력

The first line of input contains NN and MM. Each of the next NN lines describes an interval in terms of integers aia_i and bib_i.

출력

Please print 2M+12M+1 lines as output, one for each value of kk in the range 02M0 \ldots 2M.

예제 입력 1

2 5
1 3
2 5

예제 출력 1

0
0
1
3
4
4
4
3
3
1
1

점수

Test cases 1-2 satisfy N100,M100N\le 100, M\le 100.Test cases 3-5 satisfy N5000N\le 5000.Test cases 6-20 satisfy no additional constraints.

Note that output values might be too large to fit into a 32-bit integer, so you may want to use 64-bit integers (e.g., "long long" ints in C or C++).

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.