結果

問題 No.2559 眩しい数直線
ユーザー Suchmos
提出日時 2024-12-28 17:55:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 2,188 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-28 17:55:09
合計ジャッジ時間 2,899 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X=map(int,input().split())
L=[0]*X
for i in range(N):
    A,B=map(int,input().split())
    if L[A-1]<B:
        L[A-1]=B
        l,r=A-1,A-1
        while l>0 and L[l]>0:
            L[l-1]=max(L[l-1],L[l]-1)
            l-=1
        while r<X-1 and L[r]>0:
            L[r+1]=max(L[r+1],L[r]-1)
            r+=1
print(*L)
0