結果

問題 No.2559 眩しい数直線
ユーザー nzm_ortnzm_ort
提出日時 2023-12-02 14:39:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 405 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 74,112 KB
最終ジャッジ日時 2023-12-02 14:39:39
合計ジャッジ時間 2,311 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 AC 33 ms
53,460 KB
testcase_03 AC 53 ms
65,744 KB
testcase_04 AC 52 ms
65,728 KB
testcase_05 AC 60 ms
68,172 KB
testcase_06 AC 80 ms
74,112 KB
testcase_07 AC 67 ms
72,580 KB
testcase_08 AC 64 ms
70,488 KB
testcase_09 AC 61 ms
70,232 KB
testcase_10 AC 59 ms
65,848 KB
testcase_11 AC 39 ms
59,340 KB
testcase_12 AC 44 ms
63,660 KB
testcase_13 AC 66 ms
72,580 KB
testcase_14 AC 68 ms
72,584 KB
testcase_15 AC 67 ms
72,584 KB
testcase_16 AC 50 ms
66,004 KB
testcase_17 AC 62 ms
70,488 KB
testcase_18 AC 53 ms
67,796 KB
testcase_19 AC 66 ms
72,592 KB
testcase_20 AC 59 ms
70,372 KB
testcase_21 AC 50 ms
68,068 KB
testcase_22 AC 62 ms
72,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

ans = [0]*(x+1)
for i in range(n):
    a, b = ab[i][0], ab[i][1]
    ans[a] = max(ans[a], b)
    light = b-1
    idx = 1
    while light>0:
        if a-idx>=0: ans[a-idx] = max(ans[a-idx], light)
        if a+idx<=x: ans[a+idx] = max(ans[a+idx], light)
        idx += 1
        light -= 1
        
print(*ans[1:])
0