結果

問題 No.430 文字列検索
ユーザー treeonetreeone
提出日時 2016-10-05 12:45:35
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 594 bytes
コンパイル時間 1,451 ms
コンパイル使用メモリ 161,892 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-03 04:39:46
合計ジャッジ時間 14,683 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 159 ms
5,376 KB
testcase_02 TLE -
testcase_03 AC 1,081 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 720 ms
5,376 KB
testcase_12 AC 721 ms
5,376 KB
testcase_13 AC 722 ms
5,376 KB
testcase_14 AC 1,280 ms
5,376 KB
testcase_15 AC 1,489 ms
5,376 KB
testcase_16 TLE -
testcase_17 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#pragma GCC optimize ("-O3")
using namespace std;
typedef pair<int, int> P;

signed main(){
    string s;
    int m;
    cin >> s >> m;
    vector<string> c(m);
    rep(i, 0, m){
        cin >> c[i];
    }
    int ans = 0;
    rep(i, 0, m){
        int pos = s.find(c[i], 0);
        while(pos != string::npos){
            ans++;
            pos = s.find(c[i], pos + 1);
        }
    }
    cout << ans << endl;
}
0