結果

問題 No.2566 美しい整数列
ユーザー loop0919loop0919
提出日時 2023-09-21 00:58:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 791 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 154,300 KB
最終ジャッジ日時 2023-09-21 00:58:09
合計ジャッジ時間 7,905 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,684 KB
testcase_01 AC 92 ms
71,672 KB
testcase_02 WA -
testcase_03 AC 92 ms
71,808 KB
testcase_04 AC 262 ms
152,796 KB
testcase_05 AC 259 ms
154,300 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 241 ms
134,116 KB
testcase_17 AC 246 ms
137,336 KB
testcase_18 AC 249 ms
140,352 KB
testcase_19 AC 206 ms
125,672 KB
testcase_20 AC 244 ms
141,864 KB
testcase_21 AC 248 ms
137,624 KB
testcase_22 AC 192 ms
120,316 KB
testcase_23 AC 229 ms
146,620 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()

INF = 1 << 60
MOD = 998244353

# コード ---
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