結果

問題 No.430 文字列検索
ユーザー square1001square1001
提出日時 2016-11-05 13:56:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 2,138 ms
コンパイル使用メモリ 178,116 KB
実行使用メモリ 20,036 KB
最終ジャッジ日時 2024-05-03 22:14:37
合計ジャッジ時間 4,506 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 233 ms
20,032 KB
testcase_02 AC 118 ms
19,908 KB
testcase_03 AC 118 ms
19,900 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 221 ms
19,908 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 20 ms
5,376 KB
testcase_11 AC 187 ms
19,904 KB
testcase_12 AC 186 ms
19,904 KB
testcase_13 AC 187 ms
19,908 KB
testcase_14 AC 177 ms
19,884 KB
testcase_15 AC 165 ms
20,036 KB
testcase_16 AC 124 ms
20,036 KB
testcase_17 AC 116 ms
20,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
string s, t; int Q;
int main() {
	cin >> s;
	vector<string> b;
	for(int i = 1; i <= 10; i++) {
		for(int j = i; j <= s.size(); j++) {
			b.push_back(s.substr(j - i, i));
		}
	}
	sort(b.begin(), b.end());
	int ret = 0;
	cin >> Q;
	while(Q--) {
		cin >> t;
		ret += upper_bound(b.begin(), b.end(), t) - lower_bound(b.begin(), b.end(), t);
	}
	cout << ret << endl;
	return 0;
}
0