結果

問題 No.430 文字列検索
ユーザー ktgktg
提出日時 2016-10-09 19:14:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 1,452 bytes
コンパイル時間 947 ms
コンパイル使用メモリ 94,128 KB
実行使用メモリ 32,376 KB
最終ジャッジ日時 2024-05-03 04:41:13
合計ジャッジ時間 2,896 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 225 ms
32,376 KB
testcase_02 AC 18 ms
5,376 KB
testcase_03 AC 21 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 237 ms
32,000 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 17 ms
6,400 KB
testcase_11 AC 120 ms
8,576 KB
testcase_12 AC 127 ms
8,448 KB
testcase_13 AC 119 ms
8,704 KB
testcase_14 AC 99 ms
6,528 KB
testcase_15 AC 78 ms
5,376 KB
testcase_16 AC 31 ms
5,376 KB
testcase_17 AC 24 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <bits/stdc++.h>
#include <assert.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <iterator>
#include <unistd.h>

using namespace std;

typedef signed long long ll;

#define pp(...) (void)printf(__VA_ARGS__)
#define For(x,to) for(x=0;x<(to);x++)
#define ForAuto(x,arr) for(auto& x:arr)
#define ForBeginEnd(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define All(a) (a.begin()),(a.end())
#define Zeros(a) memset(a,0,sizeof(a))
#define Minus(a) memset(a,0xff,sizeof(a))

#define PI 3.14159265
#define EPS (1e-10)
#define EPS_eq(a,b) (abs((a)-(b)) < EPS)

#pragma GCC diagnostic ignored "-Wconversion"

//#define int long long
#define INF 1000*1000

int dxy[] = {0, 1, 0, -1, 0};

typedef pair<int, int> P;

void pp_int(int x){ printf("%d\n", x); };

int i,j,k;

ll M = 100000009;

//ios::sync_with_stdio(false);

//-------------------------------------------------

signed main() {
    string S;
    int M;
    map<string, int> mp;
    cin>>S>>M;
    vector<string> C(M);
    for (int i=0;i<S.size();i++){
        for(int j=1;j<=10;j++){
            if(S.size()-i>=j)
                mp[S.substr(i, j)]++;
        }
    }
    ll res = 0;
    for(int i=0;i<M;i++){
        cin>>C[i];
        res += mp[C[i]];
    }
    cout<<res<<endl;

    return 0;
}
0