結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-24 23:33:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,046 bytes |
| コンパイル時間 | 1,618 ms |
| コンパイル使用メモリ | 170,076 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 05:34:04 |
| 合計ジャッジ時間 | 2,598 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 6 |
ソースコード
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string s, t;
cin >> s >> t;
if (t.size() == 1) {
cout << 0 << endl;
return 0;
}
int cur = 0;
vector<pll> v;
while (cur < s.size()) {
if (s[cur] == t.front()) {
int l = cur;
int r = 0, cnt = 0;
while (r < t.size()) {
if (s[l] != t[r] || cnt == t.size() || l >= s.size())
break;
cnt++;
l++, r++;
}
if (cnt == t.size())
v.push_back({cur, l - 1});
}
cur++;
}
ll ans = v.size();
rep(i, v.size() - 1) {
if (v[i].second > v[i + 1].first)
ans--, i++;
}
cout << ans << endl;
}