結果

問題 No.561 東京と京都
ユーザー convexineqconvexineq
提出日時 2021-03-11 17:18:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 147 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 81,956 KB
実行使用メモリ 53,844 KB
最終ジャッジ日時 2024-04-21 06:42:36
合計ジャッジ時間 1,804 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,516 KB
testcase_01 AC 34 ms
52,324 KB
testcase_02 AC 47 ms
53,248 KB
testcase_03 AC 34 ms
52,496 KB
testcase_04 AC 34 ms
53,100 KB
testcase_05 AC 33 ms
52,768 KB
testcase_06 AC 34 ms
51,904 KB
testcase_07 AC 35 ms
52,448 KB
testcase_08 AC 39 ms
53,720 KB
testcase_09 AC 33 ms
53,844 KB
testcase_10 AC 33 ms
52,612 KB
testcase_11 AC 34 ms
52,884 KB
testcase_12 AC 41 ms
52,432 KB
testcase_13 AC 40 ms
53,624 KB
testcase_14 AC 39 ms
53,368 KB
testcase_15 AC 37 ms
52,896 KB
testcase_16 AC 35 ms
52,756 KB
testcase_17 AC 35 ms
53,008 KB
testcase_18 AC 37 ms
52,276 KB
testcase_19 AC 39 ms
52,672 KB
testcase_20 AC 35 ms
52,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d = map(int,input().split())
a,b = 0,-d
for _ in range(n):
    t,k = map(int,input().split())
    a,b = max(a,b-d)+t,max(a-d,b)+k
print(max(a,b))
0