結果

問題 No.2566 美しい整数列
ユーザー hiro1729hiro1729
提出日時 2023-12-02 15:20:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 170,568 KB
最終ジャッジ日時 2023-12-02 15:20:39
合計ジャッジ時間 6,106 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 268 ms
152,944 KB
testcase_05 AC 242 ms
149,636 KB
testcase_06 AC 173 ms
142,724 KB
testcase_07 AC 166 ms
144,496 KB
testcase_08 AC 167 ms
143,980 KB
testcase_09 AC 170 ms
144,224 KB
testcase_10 AC 167 ms
144,344 KB
testcase_11 AC 202 ms
157,816 KB
testcase_12 AC 201 ms
158,528 KB
testcase_13 AC 220 ms
157,736 KB
testcase_14 AC 204 ms
157,780 KB
testcase_15 AC 199 ms
158,308 KB
testcase_16 AC 234 ms
170,568 KB
testcase_17 AC 240 ms
168,528 KB
testcase_18 AC 242 ms
168,912 KB
testcase_19 AC 174 ms
123,736 KB
testcase_20 AC 231 ms
169,212 KB
testcase_21 AC 238 ms
169,460 KB
testcase_22 AC 165 ms
125,412 KB
testcase_23 AC 201 ms
143,744 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()))
s = [0]
for i in range(n - 1):
	s.append(s[-1] + b[i % m])
for i in range(n):
	a[i] -= s[i]
d = defaultdict(list)
for i in range(n):
	d[a[i]].append(c[i])
k = 0
for i, j in d.items():
	k = max(k, sum(j))
print(sum(c) - k)
0