結果

問題 No.2566 美しい整数列
ユーザー ymskskyymsksky
提出日時 2024-04-10 01:04:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,860 KB
実行使用メモリ 143,120 KB
最終ジャッジ日時 2024-04-10 01:04:58
合計ジャッジ時間 6,752 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,788 KB
testcase_01 AC 39 ms
52,472 KB
testcase_02 AC 38 ms
52,660 KB
testcase_03 AC 35 ms
52,292 KB
testcase_04 AC 193 ms
134,492 KB
testcase_05 AC 228 ms
135,884 KB
testcase_06 WA -
testcase_07 AC 176 ms
141,480 KB
testcase_08 AC 164 ms
122,408 KB
testcase_09 AC 170 ms
142,484 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 226 ms
142,368 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 168 ms
141,600 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
ans = float("inf")
l = al[:]
tmp = 0
for i in range(n - 1):
    # a1固定
    a1 = l[i]
    a2 = l[i + 1]
    if a2 - a1 == bl[i % m]:
        continue
    l[i + 1] = bl[i % m] + a1
    tmp += cl[i + 1]
ans = min(ans, tmp)
tmp = 0
for j in range(n - 2, -1, -1):
    # a2固定
    a1 = al[j]
    a2 = al[j + 1]
    if a2 - a1 == bl[j % m]:
        continue
    al[j] = a2 - bl[j % m]
    tmp += cl[j]
ans = min(ans, tmp)
print(ans)
0