結果

問題 No.2566 美しい整数列
ユーザー あ
提出日時 2023-12-14 01:01:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 245 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 160,128 KB
最終ジャッジ日時 2023-12-14 01:01:30
合計ジャッジ時間 7,433 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 40 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 40 ms
53,460 KB
testcase_04 AC 219 ms
156,860 KB
testcase_05 AC 245 ms
160,128 KB
testcase_06 AC 172 ms
141,776 KB
testcase_07 AC 168 ms
137,300 KB
testcase_08 AC 168 ms
139,248 KB
testcase_09 AC 171 ms
137,952 KB
testcase_10 AC 173 ms
137,948 KB
testcase_11 AC 209 ms
137,704 KB
testcase_12 AC 182 ms
138,304 KB
testcase_13 AC 178 ms
137,708 KB
testcase_14 AC 181 ms
137,728 KB
testcase_15 AC 182 ms
137,848 KB
testcase_16 AC 195 ms
147,420 KB
testcase_17 AC 228 ms
148,236 KB
testcase_18 AC 212 ms
149,872 KB
testcase_19 AC 159 ms
132,968 KB
testcase_20 AC 193 ms
147,888 KB
testcase_21 AC 196 ms
148,656 KB
testcase_22 AC 145 ms
123,644 KB
testcase_23 AC 203 ms
137,032 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()))

d = defaultdict(int)
diff = 0
for i in range(n):
    if i == 0:
        d[a[i]] += c[i]
        continue
    diff += b[(i - 1) % m]
    d[a[i] - diff] += c[i]

print(sum(c) - max(d.values()))
0