問題一覧 > 通常問題

No.2559 Dazzling Number Line

レベル : / AI推定難易度 : 137 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 287
作問者 : bluebery1001 / テスター : deuteridayo 👑 AngrySadEight Kyo_s_s kusirakusira Magentor DeltaStruct 👑 loop0919 rotti_coder ragna マベマス(mavemas_413) けんぴん aki
お気に入りにしたユーザー ProblemId : 10245 / 自分の提出
問題文最終更新日: 2023-11-30 18:44:05
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
第2回緑以下コンテスト (順位表) の他の問題:

Problem Statement

There are $N$ street lights on a number line. The $i\ (1\leq i\leq N)$-th street light is located at coordinate $A_i$ and has light intensity $B_i$.
Each street light illuminates its own location with a brightness equal to its light intensity, but the intensity decreases by $1$ for every $1$ of distance away, and becomes $0$ at distances greater than or equal to the light intensity of that street light.
That is, the light intensity of street light $i$ at coordinate $x$ is $\max(B_i - |x-A_i|,0)$.
The brightness of coordinate $x$ is the maximum of the light intensities of all street lights at coordinate $x$.
Write a program that finds the brightness of coordinate $j\ (1\leq j\leq X)$.

Input

$N\ X$
$A_1\ B_1$
$A_2\ B_2$
$\vdots$
$A_N\ B_N$
  • $1\leq N\leq 1000$
  • $1\leq X\leq 1000$
  • $1\leq A_i\leq X$
  • $1\leq B_i\leq 1000$
  • All inputs are integers.

Output

Let $L_x$ be the brightness of coordinate $x$. Output the brightness of coordinate $j\ (1\leq j\leq X)$, separated by spaces.

$L_1\ L_2\dots L_X$

Sample

Sample 1
Input
2 5
1 2
4 3
Output
2 1 2 3 2

Sample 2
Input
5 6
5 3
2 1
3 4
5 3
3 6
Output
4 5 6 5 4 3

Sample 3
Input
10 20
1 1
5 18
3 12
8 5
6 10
8 7
19 6
20 11
6 16
19 16
Output
14 15 16 17 18 17 16 15 14 13 12 11 10 11 12 13 14 15 16 15

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。