結果
問題 |
No.225 文字列変更(medium)
|
ユーザー |
|
提出日時 | 2021-08-01 22:28:53 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 400 bytes |
コンパイル時間 | 665 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 83,328 KB |
最終ジャッジ日時 | 2024-09-16 13:03:22 |
合計ジャッジ時間 | 3,212 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 5 |
ソースコード
N, M = map(int, input().split()) S = input() T = input() INF = 10**3 DP = [] for _ in range(N+1): DP.append([INF]*(M+1)) DP[0][0] = 0 for i in range(N): for j in range(M): if S[i] == T[j]: DP[i+1][j+1] = min(DP[i][j], DP[i+1][j] + 1, DP[i][j+1] + 1) else: DP[i+1][j+1] = min(DP[i+1][j+1], DP[i][j] + 1, DP[i+1][j] + 1, DP[i][j+1] + 1) print(DP[N][M])