結果

問題 No.561 東京と京都
ユーザー DexctersuDexctersu
提出日時 2017-12-23 16:24:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 271 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 7,964 KB
最終ジャッジ日時 2023-08-22 16:27:25
合計ジャッジ時間 1,305 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,960 KB
testcase_01 AC 14 ms
7,760 KB
testcase_02 WA -
testcase_03 AC 15 ms
7,708 KB
testcase_04 AC 15 ms
7,792 KB
testcase_05 WA -
testcase_06 AC 14 ms
7,768 KB
testcase_07 AC 15 ms
7,932 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 14 ms
7,708 KB
testcase_11 WA -
testcase_12 AC 15 ms
7,848 KB
testcase_13 AC 15 ms
7,852 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d=map(int,input().split())
t_i=[]
k_i=[]
for i in range(n):
    t,k=list(map(int,input().split()))
    t_i.append(t)
    k_i.append(k)

for i in range(1,n):
    t_i[i]=max(t_i[i-1],k_i[i-1]-d)+t_i[i]
    k_i[i]=max(t_i[i-1]-d,k_i[i-1])+k_i[i]
print(max(max(t_i,k_i))-d)
0