結果
| 問題 |
No.430 文字列検索
|
| コンテスト | |
| ユーザー |
square1001
|
| 提出日時 | 2016-11-05 13:56:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 229 ms / 2,000 ms |
| コード長 | 420 bytes |
| コンパイル時間 | 2,059 ms |
| コンパイル使用メモリ | 177,680 KB |
| 実行使用メモリ | 20,032 KB |
| 最終ジャッジ日時 | 2024-11-10 00:12:32 |
| 合計ジャッジ時間 | 4,581 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 |
ソースコード
#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;
}
square1001