結果
| 問題 | No.2559 眩しい数直線 | 
| コンテスト | |
| ユーザー |  oginoshikibu | 
| 提出日時 | 2023-12-02 14:50:20 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 78 ms / 2,000 ms | 
| コード長 | 607 bytes | 
| コンパイル時間 | 389 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 68,224 KB | 
| 最終ジャッジ日時 | 2024-09-26 17:30:31 | 
| 合計ジャッジ時間 | 2,572 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
from collections import deque
n,x=map(int, input().split())
AB=[list(map(int, input().split())) for _ in range(n)]
AB.sort()
D=deque(AB)
L=[0]*x
tmp=0
for i in range(x):
    tmp=max(0,tmp-1)
    while D:
        a,b=D.popleft()
        if a==i+1:
            tmp=max(tmp,b)
        else:
            D.appendleft([a,b])
            break
    L[i]=tmp
D=deque(AB[::-1])
for i in range(x-1,-1,-1):
    tmp=max(0,tmp-1)
    while D:
        a,b=D.popleft()
        if a==i+1:
            tmp=max(tmp,b)
        else:
            D.appendleft([a,b])
            break
    L[i]=max(L[i],tmp)
print(*L)
            
            
            
        