結果

問題 No.3684 chokudai_niku.png
コンテスト
ユーザー so-ishikawa
提出日時 2026-09-05 14:23:16
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 134 ms / 2,000 ms
+ 653µs
コード長 489 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 530 ms
コンパイル使用メモリ 96,464 KB
実行使用メモリ 154,496 KB
最終ジャッジ日時 2026-09-05 14:23:43
合計ジャッジ時間 10,981 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/env python3
# -*- coding: utf-8-auto -*-

N, M = map(int, input().split())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))

temp_list = [max(x[0]-x[1],0) for x in zip(A_list, B_list)]



temp = sum(temp_list[:M])
max_value = temp

for i in range(N-M+1):
    if i == 0:
        continue
    # print(i, i+M-1)
    # print(temp_list[i:i+M])
    temp = temp - temp_list[i-1] + temp_list[i+M-1]
    max_value = max(max_value, temp)
print(max_value)
0