結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
rniya
|
| 提出日時 | 2020-03-06 21:45:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 715 bytes |
| コンパイル時間 | 1,635 ms |
| コンパイル使用メモリ | 170,956 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2024-10-14 10:30:32 |
| 合計ジャッジ時間 | 2,553 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 10 |
ソースコード
#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){
if (j<t-1&&S[i]==T[j]){
chmin(dp[i+1][j+1],dp[i][j]);
chmin(dp[i+1][0],dp[i][j]+1);
}
if (S[i]!=T[j]) 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