結果
問題 | No.430 文字列検索 |
ユーザー | kyuridenamida |
提出日時 | 2016-10-28 18:56:46 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 233 ms / 2,000 ms |
コード長 | 593 bytes |
コンパイル時間 | 738 ms |
コンパイル使用メモリ | 75,336 KB |
実行使用メモリ | 32,236 KB |
最終ジャッジ日時 | 2023-08-15 20:41:31 |
合計ジャッジ時間 | 2,350 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 233 ms
32,236 KB |
testcase_02 | AC | 7 ms
4,380 KB |
testcase_03 | AC | 8 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 227 ms
31,868 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 11 ms
6,288 KB |
testcase_11 | AC | 79 ms
8,524 KB |
testcase_12 | AC | 80 ms
8,384 KB |
testcase_13 | AC | 81 ms
8,452 KB |
testcase_14 | AC | 59 ms
6,440 KB |
testcase_15 | AC | 41 ms
5,248 KB |
testcase_16 | AC | 10 ms
4,380 KB |
testcase_17 | AC | 9 ms
4,376 KB |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <cstring> #include <cstdio> #include <sstream> #include <map> using namespace std; typedef unsigned __int128 Hash; map<Hash,int> mm[11]; int main(){ string S; int M; cin >> S; cin >> M; for(int i = 0 ; i < S.size() ; i++){ Hash w = 0; for(int j = 0 ; j < 10 and i + j < S.size() ; j++){ w = w * 128 + S[i+j]; mm[j+1][w]++; } } long long ans = 0; while(M--){ cin >> S; Hash w = 0; for(int j = 0 ; j < S.size() ; j++){ w = w * 128 + S[j]; } ans += mm[S.size()][w]; } cout << ans << endl; }