結果
問題 | No.225 文字列変更(medium) |
ユーザー | roaris |
提出日時 | 2020-01-18 19:10:45 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 335 bytes |
コンパイル時間 | 528 ms |
コンパイル使用メモリ | 86,888 KB |
実行使用メモリ | 84,168 KB |
最終ジャッジ日時 | 2023-09-10 09:37:51 |
合計ジャッジ時間 | 3,913 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 71 ms
71,412 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 72 ms
71,284 KB |
testcase_08 | AC | 72 ms
71,264 KB |
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 | - |
ソースコード
n, m = map(int, input().split()) S = input() T = input() dp = [[0]*(m+1) for _ in range(n+1)] for i in range(n+1): dp[i][0] = i for i in range(m+1): dp[0][i] = i for i in range(1, n+1): for j in range(1, m+1): dp[i][j] = min(dp[i-1][j]+1, dp[i][j-1]+1, dp[i-1][j-1]+(1 if S[i-1]==T[j-1] else 0)) print(dp[n][m])