結果

問題 No.2566 美しい整数列
ユーザー KoiKoi
提出日時 2023-12-02 15:05:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 161,192 KB
最終ジャッジ日時 2023-12-02 15:05:28
合計ジャッジ時間 6,588 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 38 ms
53,460 KB
testcase_04 AC 228 ms
159,548 KB
testcase_05 AC 220 ms
161,192 KB
testcase_06 AC 189 ms
141,796 KB
testcase_07 AC 179 ms
137,328 KB
testcase_08 AC 179 ms
139,248 KB
testcase_09 AC 181 ms
137,948 KB
testcase_10 AC 180 ms
138,076 KB
testcase_11 AC 189 ms
137,732 KB
testcase_12 AC 197 ms
138,196 KB
testcase_13 AC 189 ms
137,712 KB
testcase_14 AC 189 ms
137,684 KB
testcase_15 AC 191 ms
137,444 KB
testcase_16 AC 198 ms
148,876 KB
testcase_17 AC 207 ms
150,424 KB
testcase_18 AC 210 ms
150,816 KB
testcase_19 AC 166 ms
136,028 KB
testcase_20 AC 201 ms
147,800 KB
testcase_21 AC 205 ms
150,168 KB
testcase_22 AC 151 ms
124,632 KB
testcase_23 AC 178 ms
138,224 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()))
L=[0]*N
for i in range(N-1):
    L[i+1]=L[i]+B[i%M]
S=defaultdict(int)
m=0
for i in range(N):
    S[A[i]-L[i]]+=C[i]
    if(m<S[A[i]-L[i]]):
        m=S[A[i]-L[i]]
print(sum(C)-m)
0