CF685D.Kay and Eternity

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

雪后告诉凯伊用冰块拼出单词“eternity”。凯伊急切地想完成这项任务,因为一旦成功,他便能重获自由,而雪后还将赐予他整个世界以及一双冰鞋。

雪后的宫殿后方是一片无限大的网格状场地,由若干单元格组成。场地上散布着 nn 块冰,每块冰恰好占据一个单元格,且任意两块冰不占据同一单元格。为了评估任务的难度,凯伊会考察若干边长为 k×kk \times k 个单元格的正方形区域——这些正方形的顶点均位于单元格的顶点上,且边与坐标轴平行——并统计其中所含冰块的数量。

这种方法可用来评估场地中某些区域的难度。然而,凯伊还想评估整体难度,因此提出了如下判定标准:对每个 xx(其中 1≤x≤n1 \le x \le n),他希望统计出恰好包含 xx 块冰的 k×kk \times k 正方形区域的数目。

请帮助凯伊评估雪后所布置的这项任务的难度。

输入格式

The first line of the input contains two integers n and k (1 ≤ n ≤ 100 000, 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 ( - 109 ≤ x__i, y__i ≤ 109) — 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.

输入的第一行包含两个整数 nn 和 kk(1≤n≤100 0001 \leq n \leq 100\,000,1≤k≤3001 \leq k \leq 300),分别表示冰块的数量和参数 kk 的值。接下来的 nn 行中,每行包含两个整数 xix_i 和 yiy_i(−109≤xi,yi≤109-10^9 \leq x_i, y_i \leq 10^9),表示第 ii 块冰所在格子的坐标。保证任意两块冰不占据同一格子。

输出格式

Print n integers: the number of squares of size k × k containing exactly 1, 2, ..., n pieces of the ice.

输出 n 个整数:分别表示恰好包含 1, 2, ..., n 块冰的大小为 k × k 的正方形的数量。

输入输出样例

  • 输入#1

    5 3
    4 5
    4 6
    5 5
    5 6
    7 7

    输出#1

    10 8 1 4 0

输入解题思路,AI测评打分。不知道怎么写?

首页