結果
| 問題 |
No.430 文字列検索
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-02 23:48:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 225 ms / 2,000 ms |
| コード長 | 798 bytes |
| コンパイル時間 | 1,749 ms |
| コンパイル使用メモリ | 174,484 KB |
| 実行使用メモリ | 32,000 KB |
| 最終ジャッジ日時 | 2024-11-10 00:04:59 |
| 合計ジャッジ時間 | 2,975 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T> using Graph = vector<vector<T>>;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (__typeof(a.begin()) x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define endl '\n'
string S;
int M;
int main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> S;
int N = S.size();
map<string, int> mp;
rep(i, N) {
string t;
REP(j, i, min(i + 10, N)) {
t += S[j];
mp[t]++;
}
}
ll ans = 0;
cin >> M;
rep(loop, M) {
string C;
cin >> C;
ans += mp[C];
}
cout << ans << endl;
return 0;
}