結果

問題 No.225 文字列変更(medium)
ユーザー oshamashamaoshamashama
提出日時 2020-07-28 05:54:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 770 bytes
コンパイル時間 1,540 ms
コンパイル使用メモリ 169,904 KB
実行使用メモリ 7,192 KB
最終ジャッジ日時 2023-09-11 06:19:21
合計ジャッジ時間 2,625 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,872 KB
testcase_01 AC 8 ms
5,920 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 9 ms
6,852 KB
testcase_13 WA -
testcase_14 AC 10 ms
7,192 KB
testcase_15 AC 9 ms
6,872 KB
testcase_16 AC 10 ms
6,992 KB
testcase_17 AC 8 ms
6,916 KB
testcase_18 AC 8 ms
6,804 KB
testcase_19 AC 10 ms
6,968 KB
testcase_20 WA -
testcase_21 AC 10 ms
6,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
const int INF = 1<<29;
int main() {

    int a = 0;
    cin >> a >> a;
    string S, T;
    cin >> S >> T;
    int N = max(S.size(),T.size());

    vector<vector<int> > dp(1+S.size(),vector<int>(1+T.size(),INF));
    dp.at(0).at(0) = 0;
    for (size_t i = 0; i < S.size(); i++)
    {
        for (size_t j = 0; j < T.size(); j++)
        {
            if(S.at(i) == T.at(j)){
                dp.at(i+1).at(j+1) = dp.at(i).at(j);
            }
            else
            {
                dp.at(i+1).at(j+1) = min(dp.at(i).at(j)+1,min(dp.at(i).at(j+1)+1,dp.at(i+1).at(j)+1));
            }
            
        }
        
    }
    cout << dp.at(S.size()).at(T.size()) << endl;
    

    return 0;
}
0