結果

問題 No.561 東京と京都
ユーザー convexineq
提出日時 2021-03-11 17:18:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 147 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 82,332 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-10-13 05:25:11
合計ジャッジ時間 1,642 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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