結果

問題 No.3684 chokudai_niku.png
コンテスト
ユーザー Takumi1226
提出日時 2026-09-05 13:15:50
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 162 ms / 2,000 ms
+ 828µs
コード長 687 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 225 ms
コンパイル使用メモリ 95,828 KB
実行使用メモリ 169,216 KB
最終ジャッジ日時 2026-09-05 13:16:04
合計ジャッジ時間 12,185 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import itertools
from functools import cache
import sys
from itertools import accumulate

sys.setrecursionlimit(10 ** 9)
import math
from collections import Counter, deque
input = lambda: sys.stdin.readline().rstrip()
mod = 998244353

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

toku = list()

for i in range(n):
    if a[i] - b[i] < 0:
        toku.append(0)
    else:
        toku.append(a[i] - b[i])

# print(toku)
toku_acc = [0] + list(accumulate(toku))
# print(toku_acc)

ans = 0
for i in range(1, n - m + 2):
    # print(i)
    temp_toku = toku_acc[i + m - 1] - toku_acc[i - 1]
    ans = max(ans, temp_toku)
print(ans)
0