結果

問題 No.2566 美しい整数列
ユーザー prd_xxxprd_xxx
提出日時 2023-12-02 15:52:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 168,336 KB
最終ジャッジ日時 2023-12-02 15:53:07
合計ジャッジ時間 6,116 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 39 ms
53,460 KB
testcase_04 AC 227 ms
168,336 KB
testcase_05 AC 224 ms
164,016 KB
testcase_06 AC 174 ms
125,764 KB
testcase_07 AC 177 ms
142,380 KB
testcase_08 AC 169 ms
123,856 KB
testcase_09 AC 179 ms
142,460 KB
testcase_10 AC 176 ms
142,592 KB
testcase_11 AC 186 ms
142,080 KB
testcase_12 AC 190 ms
142,576 KB
testcase_13 AC 185 ms
142,212 KB
testcase_14 AC 186 ms
142,376 KB
testcase_15 AC 191 ms
142,488 KB
testcase_16 AC 207 ms
159,384 KB
testcase_17 AC 209 ms
161,396 KB
testcase_18 AC 220 ms
162,752 KB
testcase_19 AC 160 ms
125,308 KB
testcase_20 AC 199 ms
150,248 KB
testcase_21 AC 206 ms
160,324 KB
testcase_22 AC 150 ms
131,780 KB
testcase_23 AC 177 ms
130,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

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

for i in range(N):
    A[i] -= cums[i]

sum_cost = sum(C)

from collections import defaultdict
d = defaultdict(lambda: 0)
for i,(a,c) in enumerate(zip(A,C)):
    d[a] += c

ans = sum_cost - max(d.values())
print(ans)
0