結果

問題 No.2566 美しい整数列
ユーザー loop0919loop0919
提出日時 2023-09-21 01:01:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 279 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 154,548 KB
最終ジャッジ日時 2023-09-21 01:02:05
合計ジャッジ時間 7,758 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,624 KB
testcase_01 AC 92 ms
71,576 KB
testcase_02 AC 89 ms
71,780 KB
testcase_03 AC 91 ms
71,916 KB
testcase_04 AC 261 ms
152,204 KB
testcase_05 AC 274 ms
154,548 KB
testcase_06 AC 243 ms
144,708 KB
testcase_07 AC 220 ms
148,376 KB
testcase_08 AC 224 ms
147,212 KB
testcase_09 AC 225 ms
147,864 KB
testcase_10 AC 224 ms
147,788 KB
testcase_11 AC 245 ms
147,648 KB
testcase_12 AC 241 ms
148,472 KB
testcase_13 AC 238 ms
147,784 KB
testcase_14 AC 240 ms
148,100 KB
testcase_15 AC 248 ms
148,164 KB
testcase_16 AC 245 ms
134,584 KB
testcase_17 AC 248 ms
138,244 KB
testcase_18 AC 253 ms
140,516 KB
testcase_19 AC 202 ms
125,516 KB
testcase_20 AC 279 ms
141,940 KB
testcase_21 AC 243 ms
137,996 KB
testcase_22 AC 189 ms
120,292 KB
testcase_23 AC 224 ms
146,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import系 ---
from collections import defaultdict

# 入力用 ---
INT = lambda: int(input())
MI = lambda: map(int, input().split())
MI_DEC = lambda: map(lambda x: int(x) - 1, input().split())
LI = lambda: list(map(int, input().split()))
LI_DEC = lambda: list(map(lambda x: int(x) - 1, input().split()))
LS = lambda: list(input())
LSS = lambda: input().split()


# コード ---
N, M = MI()
A_list = LI()
B_list = LI()
C_list = LI()

sum_cost = sum(C_list)

cnt = 0
diff_dict = defaultdict(int)

for i, (a, c) in enumerate(zip(A_list, C_list)):
    cnt += B_list[(i - 1) % M]
    diff_dict[cnt - a] += c

max_exempted_cost = 0

for exempted in diff_dict.values():
    max_exempted_cost = max(exempted, max_exempted_cost)

print(sum_cost - max_exempted_cost)

0