結果

問題 No.561 東京と京都
ユーザー 👑 yumechiyumechi
提出日時 2017-10-13 00:35:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 1,243 ms
コンパイル使用メモリ 85,900 KB
実行使用メモリ 71,180 KB
最終ジャッジ日時 2023-08-11 00:04:34
合計ジャッジ時間 2,959 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,180 KB
testcase_01 AC 66 ms
70,916 KB
testcase_02 AC 65 ms
71,108 KB
testcase_03 AC 68 ms
70,912 KB
testcase_04 AC 65 ms
71,100 KB
testcase_05 AC 66 ms
71,048 KB
testcase_06 AC 67 ms
70,864 KB
testcase_07 AC 68 ms
71,100 KB
testcase_08 AC 70 ms
70,992 KB
testcase_09 AC 71 ms
70,796 KB
testcase_10 AC 69 ms
70,764 KB
testcase_11 AC 68 ms
70,960 KB
testcase_12 AC 70 ms
70,944 KB
testcase_13 AC 68 ms
70,936 KB
testcase_14 AC 70 ms
70,988 KB
testcase_15 AC 71 ms
70,884 KB
testcase_16 AC 71 ms
70,700 KB
testcase_17 AC 71 ms
70,872 KB
testcase_18 AC 69 ms
70,948 KB
testcase_19 AC 67 ms
70,936 KB
testcase_20 AC 69 ms
71,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n, d = map(int, input().split())
    t, k = map(int, input().split())
    k -= d
    for _ in range(n-1):
        lt, lk = t, k
        nt, nk = map(int, input().split())
        t = max(lt + nt, lk - d + nt)
        k = max(lk + nk, lt - d + nk)
    print(max(t, k))

if __name__=="__main__":
    solve()
0