結果

問題 No.2559 眩しい数直線
ユーザー bluebery1001
提出日時 2023-11-02 19:37:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-25 22:24:02
合計ジャッジ時間 3,984 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x = map(int,input().split())
a = [-1]*n
b = [-1]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
    a[i]-=1
ans = [0]*x
for i in range(n):
    for j in range(b[i]+1):
        if a[i]+j<x:
            if ans[a[i]+j]<b[i]-j:
                ans[a[i]+j]=b[i]-j
        if a[i]-j>=0:
            if ans[a[i]-j]<b[i]-j:
                ans[a[i]-j]=b[i]-j
print(*ans)
0