結果

問題 No.2566 美しい整数列
ユーザー AngrySadEightAngrySadEight
提出日時 2023-09-20 23:08:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 168,012 KB
最終ジャッジ日時 2023-09-20 23:08:16
合計ジャッジ時間 8,986 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
71,632 KB
testcase_01 AC 92 ms
71,268 KB
testcase_02 AC 93 ms
71,428 KB
testcase_03 AC 94 ms
71,516 KB
testcase_04 AC 290 ms
165,548 KB
testcase_05 AC 285 ms
168,012 KB
testcase_06 AC 267 ms
158,148 KB
testcase_07 AC 229 ms
148,140 KB
testcase_08 AC 233 ms
147,032 KB
testcase_09 AC 229 ms
148,124 KB
testcase_10 AC 229 ms
147,816 KB
testcase_11 AC 272 ms
147,880 KB
testcase_12 AC 246 ms
148,452 KB
testcase_13 AC 241 ms
148,028 KB
testcase_14 AC 243 ms
148,260 KB
testcase_15 AC 251 ms
148,136 KB
testcase_16 AC 256 ms
143,304 KB
testcase_17 AC 260 ms
139,028 KB
testcase_18 AC 264 ms
141,760 KB
testcase_19 AC 217 ms
134,608 KB
testcase_20 AC 279 ms
144,840 KB
testcase_21 AC 267 ms
150,976 KB
testcase_22 AC 207 ms
128,180 KB
testcase_23 AC 249 ms
150,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N, M = 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 - 1):
    Bs.append(Bs[-1] + B[i % M])

ans = sum(C)
sc = ans
d = defaultdict(int)
for i in range(N):
    d[A[i] - Bs[i]] += C[i]

for x in d:
    ans = min(ans, sc - d[x])

print(ans)
0