結果

問題 No.1005 BOT対策
コンテスト
ユーザー あるふぁ
提出日時 2020-03-06 21:43:04
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 8 ms / 2,000 ms
+ 465µs
コード長 675 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,153 ms
コンパイル使用メモリ 187,292 KB
実行使用メモリ 9,920 KB
最終ジャッジ日時 2026-11-06 00:30:20
合計ジャッジ時間 3,196 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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