結果

問題 No.2566 美しい整数列
ユーザー Basin-BugBasin-Bug
提出日時 2023-12-02 16:37:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 142,212 KB
最終ジャッジ日時 2023-12-02 16:37:37
合計ジャッジ時間 5,517 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,332 KB
testcase_01 AC 36 ms
53,332 KB
testcase_02 AC 36 ms
53,332 KB
testcase_03 AC 37 ms
53,332 KB
testcase_04 AC 168 ms
133,936 KB
testcase_05 AC 168 ms
134,992 KB
testcase_06 WA -
testcase_07 AC 174 ms
142,028 KB
testcase_08 AC 164 ms
122,100 KB
testcase_09 AC 180 ms
142,020 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 171 ms
141,952 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 175 ms
141,204 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())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans1 = 0
p = A[0]
for i in range(N - 1):
  if A[i + 1] - p != B[i % M]:
    ans1 += C[i + 1]
    p = p + B[i % M]
  else:
    p = A[i + 1]

ans2 = 0
p = A[-1]
for i in range(N - 2, -1, -1):
  if p - A[i] != B[i % M]:
    ans2 += C[i]
    p = p - B[i % M]
  else:
    p = A[i]

print(min(ans1, ans2))
0