結果

問題 No.561 東京と京都
ユーザー uma66uma66
提出日時 2018-02-08 09:42:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 11,908 KB
実行使用メモリ 10,184 KB
最終ジャッジ日時 2023-10-22 02:17:17
合計ジャッジ時間 1,727 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 30 ms
10,040 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 31 ms
10,044 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 31 ms
10,052 KB
testcase_18 WA -
testcase_19 AC 30 ms
10,052 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [[0 for i in range(2)] for j in range(N)]
dp[0][0] = T
dp[0][1] = K

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