結果

問題 No.2566 美しい整数列
ユーザー 👑 timitimi
提出日時 2023-12-02 16:44:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 299 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 169,208 KB
最終ジャッジ日時 2023-12-02 16:44:46
合計ジャッジ時間 5,911 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 37 ms
53,332 KB
testcase_02 AC 36 ms
53,332 KB
testcase_03 AC 36 ms
53,332 KB
testcase_04 AC 214 ms
168,048 KB
testcase_05 AC 221 ms
169,208 KB
testcase_06 AC 172 ms
125,640 KB
testcase_07 AC 178 ms
142,256 KB
testcase_08 AC 169 ms
123,740 KB
testcase_09 AC 179 ms
142,328 KB
testcase_10 AC 181 ms
142,464 KB
testcase_11 AC 186 ms
141,940 KB
testcase_12 AC 188 ms
142,388 KB
testcase_13 AC 188 ms
142,172 KB
testcase_14 AC 211 ms
142,120 KB
testcase_15 AC 194 ms
142,232 KB
testcase_16 AC 200 ms
159,088 KB
testcase_17 AC 204 ms
161,092 KB
testcase_18 AC 204 ms
162,468 KB
testcase_19 AC 160 ms
140,552 KB
testcase_20 AC 197 ms
149,960 KB
testcase_21 AC 200 ms
160,024 KB
testcase_22 AC 146 ms
131,412 KB
testcase_23 AC 169 ms
130,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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=[0]
for i in range(N-1):
  D.append(D[-1]+B[i%M])

E={};c=0
for i in range(N):
  d=D[i]-A[i]
  if d not in E:
    E[d]=0
  E[d]+=C[i]
  c=max(c,E[d])
print(sum(C)-c)
0