結果

問題 No.2559 眩しい数直線
ユーザー けんぴんけんぴん
提出日時 2023-11-03 17:26:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 73,384 KB
最終ジャッジ日時 2023-11-03 17:26:42
合計ジャッジ時間 2,318 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,608 KB
testcase_01 AC 36 ms
53,608 KB
testcase_02 AC 35 ms
55,656 KB
testcase_03 AC 49 ms
64,152 KB
testcase_04 AC 50 ms
66,200 KB
testcase_05 AC 57 ms
69,020 KB
testcase_06 AC 62 ms
73,384 KB
testcase_07 AC 60 ms
73,224 KB
testcase_08 AC 61 ms
73,224 KB
testcase_09 AC 62 ms
71,100 KB
testcase_10 AC 53 ms
69,000 KB
testcase_11 AC 37 ms
55,656 KB
testcase_12 AC 38 ms
55,656 KB
testcase_13 AC 59 ms
73,220 KB
testcase_14 AC 73 ms
73,224 KB
testcase_15 AC 73 ms
73,364 KB
testcase_16 AC 45 ms
64,164 KB
testcase_17 AC 60 ms
73,224 KB
testcase_18 AC 49 ms
66,208 KB
testcase_19 AC 62 ms
73,224 KB
testcase_20 AC 60 ms
71,164 KB
testcase_21 AC 48 ms
64,160 KB
testcase_22 AC 62 ms
73,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N,X = map(int,input().split())
ans = [0]*X
for _ in range(N):
    # A: 座標, B: 人数
    q = deque([list(map(int,input().split()))])
    while q:
        A,B = q.popleft()
        ans[A-1] = max(ans[A-1], B)
        if 1 < A and 1 < B:
            if ans[A-2] < B-1:
                q.append([A-1, B-1])
        if A < X and 1 < B:
            if ans[A] < B-1:
                q.append([A+1, B-1])
print(*ans)
0