303544: CF685D. Kay and Eternity
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Kay and Eternity
题意翻译
网格平面上有 $n$ 个格子被涂黑,第 $i$ 个黑色格子的坐标为 $(x_i,y_i)$ 。对于在区间 $[1,n]$ 中的每一个整数 $x$ ,求恰好包含 $x$ 个黑色格子的 $k*k$ 的矩形个数。数据保证所有 $n$ 个格子不相同。题目描述
Snow Queen told Kay to form a word "eternity" using pieces of ice. Kay is eager to deal with the task, because he will then become free, and Snow Queen will give him all the world and a pair of skates. Behind the palace of the Snow Queen there is an infinite field consisting of cells. There are $ n $ pieces of ice spread over the field, each piece occupying exactly one cell and no two pieces occupying the same cell. To estimate the difficulty of the task Kay looks at some squares of size $ k×k $ cells, with corners located at the corners of the cells and sides parallel to coordinate axis and counts the number of pieces of the ice inside them. This method gives an estimation of the difficulty of some part of the field. However, Kay also wants to estimate the total difficulty, so he came up with the following criteria: for each $ x $ ( $ 1<=x<=n $ ) he wants to count the number of squares of size $ k×k $ , such that there are exactly $ x $ pieces of the ice inside. Please, help Kay estimate the difficulty of the task given by the Snow Queen.输入输出格式
输入格式
The first line of the input contains two integers $ n $ and $ k $ ( $ 1<=n<=100000 $ , $ 1<=k<=300 $ ) — the number of pieces of the ice and the value $ k $ , respectively. Each of the next $ n $ lines contains two integers $ x_{i} $ and $ y_{i} $ ( $ -10^{9}<=x_{i},y_{i}<=10^{9} $ ) — coordinates of the cell containing $ i $ -th piece of the ice. It's guaranteed, that no two pieces of the ice occupy the same cell.
输出格式
Print $ n $ integers: the number of squares of size $ k×k $ containing exactly $ 1,2,...,n $ pieces of the ice.
输入输出样例
输入样例 #1
5 3
4 5
4 6
5 5
5 6
7 7
输出样例 #1
10 8 1 4 0