結果
問題 |
No.225 文字列変更(medium)
|
ユーザー |
![]() |
提出日時 | 2020-07-03 16:01:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 526 bytes |
コンパイル時間 | 1,771 ms |
コンパイル使用メモリ | 170,916 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-09-16 17:06:59 |
合計ジャッジ時間 | 2,558 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin >> n >> m; string S,T; cin >> S >> T; int MAX = max(n,m); int INF = 100000000; vector<vector<int>>dp(MAX+1,vector<int>(m+1,INF)); dp[0][0] = 0; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { if(S[i-1] == T[j-1]) dp[i][j] = min(dp[i-1][j-1],dp[i][j]); else dp[i][j] = min(dp[i][j],min(dp[i-1][j-1]+1,min(dp[i-1][j] + 1,dp[i][j-1] + 1))); } } cout << dp[n][m]; }