結果

問題 No.2566 美しい整数列
ユーザー rlangevinrlangevin
提出日時 2023-12-13 08:52:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 160,048 KB
最終ジャッジ日時 2023-12-13 08:52:38
合計ジャッジ時間 7,579 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 41 ms
53,460 KB
testcase_02 AC 40 ms
53,460 KB
testcase_03 AC 42 ms
53,460 KB
testcase_04 AC 247 ms
156,752 KB
testcase_05 AC 225 ms
160,048 KB
testcase_06 AC 176 ms
141,652 KB
testcase_07 AC 172 ms
137,608 KB
testcase_08 AC 170 ms
139,124 KB
testcase_09 AC 170 ms
137,824 KB
testcase_10 AC 171 ms
137,828 KB
testcase_11 AC 184 ms
137,588 KB
testcase_12 AC 183 ms
138,176 KB
testcase_13 AC 183 ms
137,592 KB
testcase_14 AC 188 ms
137,732 KB
testcase_15 AC 186 ms
137,720 KB
testcase_16 AC 198 ms
147,172 KB
testcase_17 AC 203 ms
148,012 KB
testcase_18 AC 203 ms
149,648 KB
testcase_19 AC 163 ms
134,888 KB
testcase_20 AC 208 ms
147,800 KB
testcase_21 AC 197 ms
148,560 KB
testcase_22 AC 144 ms
123,592 KB
testcase_23 AC 174 ms
136,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
S = sum(C)
D = defaultdict(int)

now = 0
for i in range(N):
    D[A[i] - now] += C[i]
    now += B[i%M]

ans = 10 ** 18
for k, v in D.items():
    ans = min(ans, S - v)

print(ans) 
0