結果

問題 No.1005 BOT対策
ユーザー あるふぁ
提出日時 2020-03-06 21:43:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 1,746 ms
コンパイル使用メモリ 162,180 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-01 20:06:31
合計ジャッジ時間 2,107 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    string s, t;
    cin >> s >> t;

    int n = s.size();
    int tn = t.size();

    int c = 0;

    while (s.find(t) != string::npos) {
        c++;
        auto p = s.find(t);
        p += tn - 1;
        s.insert(p, ".");

        if (tn == 1 && c > 5 * n) {
            cout << "-1" << endl;
            exit(0);
        }
    }

    cout << c << endl;

    return 0;
}
0