結果

問題 No.1104 オンライン点呼
ユーザー lam6er
提出日時 2025-03-31 17:46:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 364 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 103,944 KB
最終ジャッジ日時 2025-03-31 17:47:16
合計ジャッジ時間 3,887 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if n == 1:
    print(0)
else:
    t = [0] * n
    t[0] = 0
    t[1] = a[0] + b[1]
    
    for j in range(2, n):
        option1 = t[j-1] + a[j-1] + b[j]
        option2 = t[j-2] + a[j-2] + b[j] + k
        t[j] = min(option1, option2)
    
    print(max(t))
0