結果

問題 No.430 文字列検索
コンテスト
ユーザー Kmcode1
提出日時 2016-10-02 22:33:03
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 178 ms / 2,000 ms
+ 939µs
コード長 403 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 970 ms
コンパイル使用メモリ 188,712 KB
実行使用メモリ 32,640 KB
最終ジャッジ日時 2026-10-11 20:28:26
合計ジャッジ時間 3,253 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;

map<string, int> mp;
string s;
int m;
char buf[100002];
int main(){
	cin >> s;
	for (int i = 0; i < s.size(); i++){
		for (int j = 0; j < 10; j++){
			if (i + j >= s.size()){
				break;
			}
			mp[s.substr(i, j + 1)]++;
		}
	}
	int ans = 0;
	cin >> m;
	for (int i = 0; i < m; i++){
		scanf("%s", buf);
		ans += mp[buf];
	}
	cout << ans << endl;
	return 0;
}
0