結果

問題 No.2559 眩しい数直線
ユーザー prd_xxxprd_xxx
提出日時 2023-12-02 14:35:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 345 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2023-12-02 14:36:33
合計ジャッジ時間 4,984 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,984 KB
testcase_01 AC 29 ms
9,984 KB
testcase_02 AC 29 ms
9,984 KB
testcase_03 AC 78 ms
9,984 KB
testcase_04 AC 80 ms
9,984 KB
testcase_05 AC 113 ms
9,984 KB
testcase_06 AC 345 ms
10,112 KB
testcase_07 AC 238 ms
10,112 KB
testcase_08 AC 222 ms
10,112 KB
testcase_09 AC 189 ms
10,112 KB
testcase_10 AC 91 ms
9,984 KB
testcase_11 AC 30 ms
9,984 KB
testcase_12 AC 45 ms
9,984 KB
testcase_13 AC 279 ms
10,112 KB
testcase_14 AC 268 ms
10,112 KB
testcase_15 AC 337 ms
10,112 KB
testcase_16 AC 36 ms
9,984 KB
testcase_17 AC 205 ms
10,112 KB
testcase_18 AC 80 ms
9,984 KB
testcase_19 AC 284 ms
10,112 KB
testcase_20 AC 140 ms
9,984 KB
testcase_21 AC 47 ms
9,984 KB
testcase_22 AC 230 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N,X = map(int,input().split())
AB = [tuple(map(int,input().split())) for _ in range(N)]

ans = [0] * (X+1)
for a,b in AB:
    now = b
    i = a
    while now:
        ans[i] = max(ans[i], now)
        now -= 1
        i -= 1
        if i < 0: break
    now = b
    i = a
    while now:
        ans[i] = max(ans[i], now)
        now -= 1
        i += 1
        if i > X: break
print(*ans[1:])
0