結果
| 問題 | No.3684 chokudai_niku.png |
| コンテスト | |
| ユーザー |
Prala
|
| 提出日時 | 2026-09-05 13:07:31 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
AC
|
| 実行時間 | 138 ms / 2,000 ms |
| + 58µs | |
| コード長 | 868 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 95,832 KB |
| 実行使用メモリ | 152,960 KB |
| 最終ジャッジ日時 | 2026-09-05 13:08:14 |
| 合計ジャッジ時間 | 11,483 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
import sys
import math
import bisect
import heapq
from collections import deque, defaultdict
#160427717982164055zq
# -------------------------------------------------
def ST(): return input().rstrip()
def IN(): return int(input())
def ML(typ=int): return [typ(x) for x in input().split()]
def IM(): return ML()
def IL(): return ML()
def SR(n:int)->list: return [input().rstrip() for _ in range(n)]
def IMatrix(n:int)->list: return [Mul(int) for _ in range(n)]
def prefix_sum(L): #1次元リストの累積和を返す
ret = [L[0]]
for i in range(1, len(L)):
ret.append(ret[i-1]+L[i])
return ret
N, M = IM()
A = [0]+IL()
B = [0]+IL()
for i in range(1, N+1):
if A[i] < B[i]:
A[i] = 0
B[i] = 0
#print(A, B)
pA = prefix_sum(A)
pB = prefix_sum(B)
ans = 0
for i in range(N-M+1):
ans = max(ans, pA[i+M]-pA[i]+pB[i]-pB[i+M])
print(ans)
Prala