結果

問題 No.561 東京と京都
ユーザー mlihua09mlihua09
提出日時 2020-08-28 10:38:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 53,496 KB
最終ジャッジ日時 2024-04-26 10:33:51
合計ジャッジ時間 1,739 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,216 KB
testcase_01 AC 36 ms
53,356 KB
testcase_02 AC 37 ms
52,316 KB
testcase_03 AC 37 ms
52,308 KB
testcase_04 AC 36 ms
53,008 KB
testcase_05 AC 36 ms
52,884 KB
testcase_06 AC 37 ms
52,272 KB
testcase_07 AC 35 ms
52,592 KB
testcase_08 AC 39 ms
53,352 KB
testcase_09 AC 40 ms
52,068 KB
testcase_10 AC 36 ms
53,496 KB
testcase_11 AC 37 ms
52,552 KB
testcase_12 AC 38 ms
53,416 KB
testcase_13 AC 41 ms
52,484 KB
testcase_14 AC 38 ms
52,388 KB
testcase_15 AC 40 ms
52,772 KB
testcase_16 AC 37 ms
52,900 KB
testcase_17 AC 39 ms
52,268 KB
testcase_18 AC 37 ms
52,888 KB
testcase_19 AC 37 ms
52,912 KB
testcase_20 AC 39 ms
52,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


N, D = map(int, input().split())

dpt = 0

dpk = -D

for i in range(N):
    
    t, k = map(int, input().split())
    
    dpt, dpk = max(dpt + t, dpk + t - D), max(dpt + k - D, dpk + k)
    
print(max(dpt, dpk))
0