結果

問題 No.2566 美しい整数列
ユーザー 👑 tipstar0125tipstar0125
提出日時 2024-01-08 20:55:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 176,228 KB
最終ジャッジ日時 2024-01-08 20:55:22
合計ジャッジ時間 7,357 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,332 KB
testcase_01 AC 38 ms
53,332 KB
testcase_02 AC 38 ms
53,332 KB
testcase_03 AC 37 ms
53,332 KB
testcase_04 AC 236 ms
170,504 KB
testcase_05 AC 238 ms
176,228 KB
testcase_06 AC 173 ms
141,672 KB
testcase_07 AC 170 ms
137,344 KB
testcase_08 AC 177 ms
139,244 KB
testcase_09 AC 168 ms
137,952 KB
testcase_10 AC 168 ms
137,952 KB
testcase_11 AC 182 ms
139,388 KB
testcase_12 AC 181 ms
138,964 KB
testcase_13 AC 180 ms
139,304 KB
testcase_14 AC 187 ms
138,836 KB
testcase_15 AC 182 ms
139,236 KB
testcase_16 AC 198 ms
160,024 KB
testcase_17 AC 203 ms
162,364 KB
testcase_18 AC 203 ms
162,968 KB
testcase_19 AC 157 ms
134,112 KB
testcase_20 AC 215 ms
159,024 KB
testcase_21 AC 202 ms
161,388 KB
testcase_22 AC 146 ms
131,800 KB
testcase_23 AC 171 ms
136,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

BS=[0]
for i in range(N):
    BS.append(BS[-1]+B[i%M])

mp=defaultdict(int)
for (i,a) in enumerate(A):
    mp[a-BS[i]]+=C[i]

s=sum(C)
ans=s
for (_,v) in mp.items():
    ans=min(ans,s-v)
print(ans)
0