結果

問題 No.561 東京と京都
ユーザー URechaRecha
提出日時 2019-09-04 08:22:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 241 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-26 00:37:23
合計ジャッジ時間 1,587 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 1 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D = map(int,input().split())
t,k = map(int,input().split())
dp=[[t,k-D],[0,0]]
for _ in range(N-1):
    t,k= map(int,input().split())
    dp[1][0] = t + max(dp[0][0],dp[0][1]-D)
    dp[1][1] = k + max(dp[0][0]-D,dp[0][1])
print(max(dp[1]))
0