結果
| 問題 | 
                            No.1005 BOT対策
                             | 
                    
| コンテスト | |
| ユーザー | 
                             rniya
                         | 
                    
| 提出日時 | 2020-03-06 21:58:32 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 692 bytes | 
| コンパイル時間 | 1,624 ms | 
| コンパイル使用メモリ | 170,508 KB | 
| 実行使用メモリ | 6,400 KB | 
| 最終ジャッジ日時 | 2024-10-14 10:36:37 | 
| 合計ジャッジ時間 | 2,552 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 WA * 12 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
template<class T> inline bool chmin(T &a,T b){
    if (a>b){a=b; return true;} return false;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T; cin >> S >> T;
    int s=S.size(),t=T.size();
    vector<vector<int>> dp(s+1,vector<int>(t,INF));
    dp[0][0]=0;
    for (int i=0;i<s;++i){
        for (int j=0;j<t;++j){
            chmin(dp[i+1][0],dp[i][j]+1);
            if (S[i]==T[j]){
                if (j<t-1) chmin(dp[i+1][j+1],dp[i][j]);
            } else chmin(dp[i+1][0],dp[i][j]);
        }
    }
    int ans=INF;
    for (int j=0;j<t;++j) chmin(ans,dp[s][j]);
    cout << ans << '\n';
}
            
            
            
        
            
rniya