結果

問題 No.2566 美しい整数列
ユーザー nikoro256nikoro256
提出日時 2023-12-09 12:49:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 160,056 KB
最終ジャッジ日時 2023-12-09 12:49:22
合計ジャッジ時間 6,392 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,332 KB
testcase_01 AC 38 ms
53,332 KB
testcase_02 AC 38 ms
53,332 KB
testcase_03 AC 38 ms
53,332 KB
testcase_04 AC 240 ms
156,744 KB
testcase_05 AC 221 ms
160,056 KB
testcase_06 AC 168 ms
141,672 KB
testcase_07 AC 188 ms
137,156 KB
testcase_08 AC 165 ms
139,016 KB
testcase_09 AC 164 ms
137,824 KB
testcase_10 AC 170 ms
137,828 KB
testcase_11 AC 180 ms
137,600 KB
testcase_12 AC 179 ms
138,192 KB
testcase_13 AC 176 ms
137,600 KB
testcase_14 AC 179 ms
137,688 KB
testcase_15 AC 182 ms
137,320 KB
testcase_16 AC 207 ms
147,064 KB
testcase_17 AC 201 ms
148,992 KB
testcase_18 AC 204 ms
149,528 KB
testcase_19 AC 161 ms
134,884 KB
testcase_20 AC 194 ms
147,800 KB
testcase_21 AC 210 ms
148,560 KB
testcase_22 AC 147 ms
123,612 KB
testcase_23 AC 175 ms
136,944 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()))
left=0
for i in range(N):
    A[i]-=left
    left+=B[i%M]
dic=defaultdict(int)
all=0
for i in range(N):
    dic[A[i]]+=C[i]
    all+=C[i]
ans=10**20
for k in dic.keys():
    ans=min(all-dic[k],ans)
print(ans)
0