結果

問題 No.225 文字列変更(medium)
ユーザー rpy3cpprpy3cpp
提出日時 2015-09-08 00:44:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,046 ms / 5,000 ms
コード長 227 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 39,648 KB
最終ジャッジ日時 2023-08-25 23:06:05
合計ジャッジ時間 12,998 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 408 ms
19,584 KB
testcase_01 AC 741 ms
29,564 KB
testcase_02 AC 15 ms
7,748 KB
testcase_03 AC 15 ms
7,808 KB
testcase_04 AC 15 ms
7,796 KB
testcase_05 AC 15 ms
7,872 KB
testcase_06 AC 16 ms
7,804 KB
testcase_07 AC 15 ms
7,780 KB
testcase_08 AC 15 ms
7,784 KB
testcase_09 AC 16 ms
7,856 KB
testcase_10 AC 16 ms
7,920 KB
testcase_11 AC 16 ms
7,864 KB
testcase_12 AC 1,018 ms
33,036 KB
testcase_13 AC 1,046 ms
39,648 KB
testcase_14 AC 1,029 ms
38,040 KB
testcase_15 AC 972 ms
23,264 KB
testcase_16 AC 1,046 ms
37,240 KB
testcase_17 AC 990 ms
23,300 KB
testcase_18 AC 949 ms
28,264 KB
testcase_19 AC 983 ms
37,488 KB
testcase_20 AC 954 ms
30,412 KB
testcase_21 AC 987 ms
36,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
S=input()
T=input()
d=[[i]+[-1]*m for i in range(n+1)]
d[0]=list(range(m+1))
for a in range(n):
 for b in range(m):d[a+1][b+1]=[1+min(d[a][b],d[a+1][b],d[a][b+1]),d[a][b]][S[a]==T[b]]
print(d[n][m])
0