結果

問題 No.2566 美しい整数列
ユーザー 👑 H20H20
提出日時 2023-12-02 16:49:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 162,984 KB
最終ジャッジ日時 2023-12-02 16:49:58
合計ジャッジ時間 5,691 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,332 KB
testcase_01 AC 41 ms
53,332 KB
testcase_02 AC 39 ms
55,488 KB
testcase_03 AC 35 ms
53,332 KB
testcase_04 AC 200 ms
153,320 KB
testcase_05 AC 194 ms
141,948 KB
testcase_06 AC 164 ms
141,684 KB
testcase_07 AC 164 ms
137,336 KB
testcase_08 AC 160 ms
139,140 KB
testcase_09 AC 189 ms
137,892 KB
testcase_10 AC 160 ms
138,068 KB
testcase_11 AC 174 ms
139,456 KB
testcase_12 AC 175 ms
139,716 KB
testcase_13 AC 171 ms
139,248 KB
testcase_14 AC 173 ms
139,476 KB
testcase_15 AC 175 ms
139,236 KB
testcase_16 AC 211 ms
160,048 KB
testcase_17 AC 192 ms
162,376 KB
testcase_18 AC 198 ms
162,984 KB
testcase_19 AC 143 ms
121,820 KB
testcase_20 AC 190 ms
159,036 KB
testcase_21 AC 197 ms
162,100 KB
testcase_22 AC 141 ms
128,872 KB
testcase_23 AC 187 ms
136,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N,M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
for i in reversed(range(N)):
    A[i]-=A[0]
DIFF = [0]
for i in range(N-1):
    DIFF.append(DIFF[-1]+A[i]-A[i+1]+B[i%M])

D = collections.defaultdict(int)
for diff,c in zip(DIFF,C):
    D[diff]+=c
ma = 0
for v in D.values():
    ma = max(ma,v)
print(sum(C)-ma)
0