結果

問題 No.430 文字列検索
ユーザー roiti46roiti46
提出日時 2016-10-02 23:48:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 301 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 1,666 ms
コンパイル使用メモリ 173,452 KB
実行使用メモリ 31,796 KB
最終ジャッジ日時 2023-08-15 17:28:11
合計ジャッジ時間 3,848 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 301 ms
31,796 KB
testcase_02 AC 17 ms
4,380 KB
testcase_03 AC 19 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 285 ms
31,744 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 19 ms
6,268 KB
testcase_11 AC 125 ms
8,080 KB
testcase_12 AC 127 ms
8,092 KB
testcase_13 AC 133 ms
8,388 KB
testcase_14 AC 100 ms
6,228 KB
testcase_15 AC 78 ms
5,232 KB
testcase_16 AC 29 ms
4,380 KB
testcase_17 AC 23 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0