結果

問題 No.430 文字列検索
ユーザー kotamanegikotamanegi
提出日時 2016-10-02 23:15:21
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,292 bytes
コンパイル時間 1,183 ms
コンパイル使用メモリ 96,496 KB
実行使用メモリ 13,896 KB
最終ジャッジ日時 2024-05-01 10:06:09
合計ジャッジ時間 4,583 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,960 KB
testcase_01 WA -
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONGINF 1000000000000000000
vector<string> hoge;
int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int kazu;
	cin >> kazu;
	REP(i, kazu) {
		string aaa;
		cin >> aaa;
		hoge.push_back(aaa);
	}
	sort(hoge.begin(), hoge.end());
	vector<char> calc;
	for (int i = 0;i < kazu;++i) {
		calc.push_back(hoge[i][0]);
	}
	int ans = 0;
	for (int i = 0;i < s.length();++i) {
		auto it1 = lower_bound(calc.begin(), calc.end(), s[i]);
		int sizei = it1 - calc.begin();
		for (auto j = hoge.begin() + sizei;j < hoge.end();++j) {
			string ppp = *j;
			if (ppp[0] != s[i]||i+ppp.length()-1 >= s.length()) goto done;
			for (int q = 1;q < ppp.length();++q) {
				if (ppp[q] != s[i + q]) goto failed;
			}
			ans++;
		failed:;
		}
	done:;
	}
	cout << ans << endl;
	return 0;
}
0