結果
| 問題 |
No.225 文字列変更(medium)
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-10-23 23:26:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 345 bytes |
| コンパイル時間 | 1,261 ms |
| コンパイル使用メモリ | 82,140 KB |
| 実行使用メモリ | 277,776 KB |
| 最終ジャッジ日時 | 2024-10-23 23:27:10 |
| 合計ジャッジ時間 | 13,343 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 21 |
ソースコード
from functools import lru_cache
@lru_cache(maxsize=10000)
def f(x, y):
if x == 0:
return y
if y == 0:
return x
if S[x - 1] == T[y - 1]:
return f(x - 1, y - 1)
else:
return min(f(x - 1, y), f(x, y - 1), f(x - 1, y - 1)) + 1
n, m = map(int, input().split())
S = input()
T = input()
print(f(n, m))
ntuda