結果

問題 No.2603 Tone Correction
ユーザー ShirotsumeShirotsume
提出日時 2024-01-12 22:37:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 153,120 KB
最終ジャッジ日時 2024-01-12 22:37:49
合計ジャッジ時間 22,808 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
88,076 KB
testcase_01 AC 138 ms
88,076 KB
testcase_02 AC 144 ms
88,588 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 136 ms
88,076 KB
testcase_34 AC 780 ms
147,116 KB
testcase_35 AC 768 ms
147,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import fractions
import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n, m = mi()

a = li()
b = li()
c = [0]
for i in range(n):
    c.append(b[i] - a[i])
c.append(0)
n = len(c)

dp = [[inf] * 20 for _ in range(n + 1)]
dp[0][5] = 0
for i in range(n - 1):
    for j in range(11):
        for k in range(11):
            dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + abs(c[i] + m * (j - 5) - (c[i + 1] + m * (k - 5))))
print(dp[n - 1][5] // 2)
            
0