結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
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 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

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(diff_dict)
print(sum_cost - max_exempted_cost)

0