結果
| 問題 | No.3684 chokudai_niku.png |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-05 13:15:50 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
AC
|
| 実行時間 | 162 ms / 2,000 ms |
| + 828µs | |
| コード長 | 687 bytes |
| 記録 | |
| コンパイル時間 | 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 |
ソースコード
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)