結果

問題 No.2559 眩しい数直線
ユーザー oginoshikibuoginoshikibu
提出日時 2023-12-02 14:50:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 68,008 KB
最終ジャッジ日時 2023-12-02 14:50:23
合計ジャッジ時間 2,040 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
55,604 KB
testcase_01 AC 34 ms
55,604 KB
testcase_02 AC 34 ms
55,604 KB
testcase_03 AC 39 ms
57,660 KB
testcase_04 AC 42 ms
57,660 KB
testcase_05 AC 44 ms
63,188 KB
testcase_06 AC 58 ms
68,008 KB
testcase_07 AC 58 ms
68,000 KB
testcase_08 AC 60 ms
68,008 KB
testcase_09 AC 49 ms
63,188 KB
testcase_10 AC 45 ms
57,660 KB
testcase_11 AC 40 ms
55,604 KB
testcase_12 AC 41 ms
55,604 KB
testcase_13 AC 56 ms
68,000 KB
testcase_14 AC 57 ms
68,008 KB
testcase_15 AC 59 ms
68,008 KB
testcase_16 AC 44 ms
61,116 KB
testcase_17 AC 53 ms
65,940 KB
testcase_18 AC 42 ms
61,116 KB
testcase_19 AC 53 ms
68,000 KB
testcase_20 AC 48 ms
63,588 KB
testcase_21 AC 45 ms
61,132 KB
testcase_22 AC 56 ms
65,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


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)
0