結果

問題 No.430 文字列検索
ユーザー CleyLCleyL
提出日時 2020-02-01 15:13:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 807 ms
コンパイル使用メモリ 80,264 KB
実行使用メモリ 32,492 KB
最終ジャッジ日時 2023-10-19 00:03:27
合計ジャッジ時間 3,052 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 369 ms
32,492 KB
testcase_02 AC 20 ms
4,348 KB
testcase_03 AC 22 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 367 ms
32,164 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 19 ms
6,524 KB
testcase_11 AC 101 ms
8,612 KB
testcase_12 AC 100 ms
8,680 KB
testcase_13 AC 100 ms
8,700 KB
testcase_14 AC 77 ms
6,728 KB
testcase_15 AC 63 ms
5,616 KB
testcase_16 AC 31 ms
4,348 KB
testcase_17 AC 28 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
map<string,int> A;
int main(){
    string s;cin>>s;
    for(int i = 1; min((int)s.size(),10) >= i; i++){
        for(int j = 0; s.size()-i >= j; j++){
            A[s.substr(j,i)]+=1;
        }
    }
    int m;cin>>m;
    int ans = 0;
    for(int i = 0; m > i; i++){
        string s;cin>>s;
        ans += A[s];
    }
    cout << ans << endl;
}
0