結果
| 問題 |
No.225 文字列変更(medium)
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-10-23 23:29:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 347 bytes |
| コンパイル時間 | 403 ms |
| コンパイル使用メモリ | 82,396 KB |
| 実行使用メモリ | 244,244 KB |
| 最終ジャッジ日時 | 2024-10-23 23:30:00 |
| 合計ジャッジ時間 | 4,792 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 RE * 11 |
ソースコード
from functools import lru_cache
@lru_cache(maxsize=1000000)
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