結果

問題 No.225 文字列変更(medium)
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-03-28 10:35:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 317 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 42,168 KB
最終ジャッジ日時 2023-09-07 19:19:33
合計ジャッジ時間 14,228 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 458 ms
19,944 KB
testcase_01 AC 762 ms
30,340 KB
testcase_02 AC 18 ms
7,816 KB
testcase_03 AC 16 ms
7,840 KB
testcase_04 AC 16 ms
7,952 KB
testcase_05 WA -
testcase_06 AC 18 ms
7,856 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 18 ms
7,844 KB
testcase_10 AC 18 ms
7,896 KB
testcase_11 AC 16 ms
7,892 KB
testcase_12 AC 1,067 ms
37,680 KB
testcase_13 WA -
testcase_14 AC 1,148 ms
41,012 KB
testcase_15 AC 1,043 ms
31,484 KB
testcase_16 AC 1,076 ms
39,796 KB
testcase_17 AC 1,070 ms
31,748 KB
testcase_18 AC 1,049 ms
35,028 KB
testcase_19 AC 1,091 ms
39,872 KB
testcase_20 WA -
testcase_21 AC 1,076 ms
39,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
s = input()
t = input()
dp = [[1001]*(m+1) for _ in range(n+1)]
dp[0][0] = 0
for i in range(1, n+1):
    for j in range(1, m+1):
        dp[i][j] = min(
                int(s[i-1]!=t[j-1]) + dp[i-1][j-1],
                1 + dp[i-1][j],
                1 + dp[i][j-1])
print(dp[n][m])
0