結果

問題 No.430 文字列検索
ユーザー ldsybldsyb
提出日時 2017-07-20 02:01:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 274 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 79,616 KB
実行使用メモリ 32,384 KB
最終ジャッジ日時 2024-04-17 04:15:52
合計ジャッジ時間 2,795 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 274 ms
32,384 KB
testcase_02 AC 21 ms
5,376 KB
testcase_03 AC 24 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 265 ms
32,000 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 20 ms
6,528 KB
testcase_11 AC 143 ms
8,448 KB
testcase_12 AC 139 ms
8,448 KB
testcase_13 AC 139 ms
8,704 KB
testcase_14 AC 110 ms
6,656 KB
testcase_15 AC 91 ms
5,504 KB
testcase_16 AC 36 ms
5,376 KB
testcase_17 AC 28 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

int main(){
	map<string, int> mp;
	string s;
	int n;
	cin >> s >> n;
	for(int i = 0; i < s.size(); i++) for(int j = 1; j <= 10; j++) if(i + j <= s.size()) mp[s.substr(i, j)]++;
	int ans = 0;
	while(n--){
		string t;
		cin >> t;
		ans += mp[t];
	}
	cout << ans << endl;
}
0