結果
問題 | No.225 文字列変更(medium) |
ユーザー | moriiforfun |
提出日時 | 2018-06-13 00:11:13 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 394 bytes |
コンパイル時間 | 105 ms |
コンパイル使用メモリ | 10,972 KB |
実行使用メモリ | 39,828 KB |
最終ジャッジ日時 | 2023-09-13 03:43:52 |
合計ジャッジ時間 | 5,326 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 15 ms
7,804 KB |
testcase_03 | AC | 15 ms
7,928 KB |
testcase_04 | AC | 16 ms
7,828 KB |
testcase_05 | RE | - |
testcase_06 | AC | 15 ms
7,760 KB |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | AC | 16 ms
7,864 KB |
testcase_12 | RE | - |
testcase_13 | AC | 921 ms
39,828 KB |
testcase_14 | AC | 865 ms
38,032 KB |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | AC | 860 ms
37,556 KB |
testcase_20 | RE | - |
testcase_21 | AC | 809 ms
36,324 KB |
ソースコード
suteru=input() S=input() T=input() ls = len(S) lt = len(T) dp = [[0]*(ls+10) for _ in range(lt+10)] for i in range(ls+1): dp[i][0] = i for j in range(lt+1): dp[0][j] = j for i in range(1,ls+1): for j in range(1,lt+1): if S[i-1] == T[j-1]: dp[i][j] = dp[i-1][j-1] else: dp[i][j] = min(dp[i-1][j],dp[i][j-1],dp[i-1][j-1]) + 1 print(dp[ls][lt])