結果
| 問題 |
No.430 文字列検索
|
| ユーザー |
ヒッキープログラミングするスレ
|
| 提出日時 | 2016-10-02 23:50:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 768 bytes |
| コンパイル時間 | 598 ms |
| コンパイル使用メモリ | 75,692 KB |
| 実行使用メモリ | 10,660 KB |
| 最終ジャッジ日時 | 2024-11-10 00:05:07 |
| 合計ジャッジ時間 | 4,244 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 2 TLE * 1 -- * 11 |
ソースコード
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int main() {
string al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
map<char,vector<string> > mp;
for (auto c = al.begin(); c != al.end(); c++) {
mp[*c] = vector<string>();
}
string s;
cin >> s;
int m;
cin >> m;
for (int i = 0; i < m; i++) {
string c;
cin >> c;
mp[c[0]].push_back(c);
}
int ans = 0;
for (auto i = 0U; i < s.size(); i++) {
vector<string> v = mp[s[i]];
for (auto x = v.begin(); x != v.end(); x++) {
if (*x == s.substr(i, x->size())) {
ans++;
}
}
}
cout << ans << endl;
return 0;
}
ヒッキープログラミングするスレ