結果
| 問題 | No.430 文字列検索 |
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-10-02 23:57:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 559 bytes |
| 記録 | |
| コンパイル時間 | 540 ms |
| コンパイル使用メモリ | 70,112 KB |
| 実行使用メモリ | 10,532 KB |
| 最終ジャッジ日時 | 2024-11-10 00:05:41 |
| 合計ジャッジ時間 | 3,999 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 2 TLE * 1 -- * 11 |
ソースコード
#include <iostream>
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main()
{
string s;
cin >> s;
int m; cin >> m;
int ans = 0;
vector<int> alp[26];
for (int i = 0; i < s.size(); i++)alp[s[i] - 'A'].push_back(i);
for (int i = 0; i < m; i++) {
string target; cin >> target;
if (target[0] < 65 || 90 < target[0])continue;
for (int i = 0; i < alp[target[0] - 'A'].size(); i++) {
string sub = s.substr(alp[target[0] - 'A'][i], target.size());
if (sub == target)ans++;
}
}
cout << ans << endl;
return 0;
}
kurenai3110