結果
| 問題 | No.225 文字列変更(medium) |
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-10-23 23:29:55 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 347 bytes |
| 記録 | |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 85,556 KB |
| 実行使用メモリ | 242,628 KB |
| 最終ジャッジ日時 | 2026-05-05 19:13:47 |
| 合計ジャッジ時間 | 3,215 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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