結果

問題 No.3684 chokudai_niku.png
コンテスト
ユーザー 黒目
提出日時 2026-09-07 17:57:02
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 105 ms / 2,000 ms
+ 148µs
コード長 382 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 73 ms
コンパイル使用メモリ 80,896 KB
実行使用メモリ 139,008 KB
最終ジャッジ日時 2026-09-07 17:57:13
合計ジャッジ時間 9,620 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, M = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

c_list = []

for n in range(N):
    a = a_list[n]
    b = b_list[n]
    c_list.append(max(0, a - b))

res = 0
for m in range(M):
    res += c_list[m]

now = res
for n in range(N - M):
    now -= c_list[n]
    now += c_list[n + M]
    res = max(res, now)

print(res)
0