This documentation is automatically generated by competitive-verifier/competitive-verifier
// competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/problems/2863
#include "string/aho_corasick.hpp"
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include "math/modint.hpp"
#include "tree/tree_function.hpp"
using Mint = modint107;
int main(void) {
int m;
std::cin >> m;
std::vector<std::string> t(m);
for (auto &e : t) std::cin >> e;
aho_corasick<26, 'a'> aho;
std::vector<std::vector<int>> correct;
for (int i = 0; i < m; ++i) {
auto v = aho.insert(t[i]);
correct.resize(aho.size());
correct[v.back()].emplace_back(i);
}
aho.build();
auto failure = aho.failures();
auto bfs = tree_bfs(failure);
for (auto x : bfs) {
int y = failure[x];
std::vector<int> v;
std::set_union(correct[x].begin(), correct[x].end(), correct[y].begin(), correct[y].end(),
std::back_inserter(v));
correct[x] = v;
}
std::string s;
std::cin >> s;
int n = s.size();
auto res = aho.search(s);
std::vector<Mint> dp(n + 1);
dp[0] = 1;
for (int i = 0; i < n + 1; ++i) {
for (auto y : correct[res[i]]) dp[i] += dp[i - t[y].size()];
}
std::cout << dp.back() << '\n';
return 0;
}
Traceback (most recent call last):
File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/resolver.py", line 291, in resolve
bundled_code = language.bundle(path, basedir=basedir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus.py", line 242, in bundle
bundler.update(path)
File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 479, in update
self._resolve(pathlib.Path(included), included_from=path)
File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 286, in _resolve
raise BundleErrorAt(path, -1, "no such header")
competitive_verifier.oj.verify.languages.cplusplus_bundle.BundleErrorAt: string/aho_corasick.hpp: line -1: no such header
| Env | Name | Status | Elapsed | Memory |
|---|---|---|---|---|
| g++ | 00_sample_00 |
|
2 ms | 3 MB |
| g++ | 00_sample_01 |
|
2 ms | 4 MB |
| g++ | 00_sample_02 |
|
2 ms | 4 MB |
| g++ | 00_sample_03 |
|
2 ms | 4 MB |
| g++ | 10_rand_00 |
|
65 ms | 40 MB |
| g++ | 10_rand_01 |
|
61 ms | 43 MB |
| g++ | 10_rand_02 |
|
73 ms | 43 MB |
| g++ | 10_rand_03 |
|
70 ms | 49 MB |
| g++ | 10_rand_04 |
|
41 ms | 28 MB |
| g++ | 11_rand_00 |
|
78 ms | 53 MB |
| g++ | 11_rand_01 |
|
75 ms | 50 MB |
| g++ | 11_rand_02 |
|
78 ms | 52 MB |
| g++ | 11_rand_03 |
|
77 ms | 50 MB |
| g++ | 11_rand_04 |
|
79 ms | 51 MB |
| g++ | 20_fixed_length_00 |
|
79 ms | 41 MB |
| g++ | 20_fixed_length_01 |
|
83 ms | 41 MB |
| g++ | 20_fixed_length_02 |
|
79 ms | 43 MB |
| g++ | 21_fixed_length_00 |
|
58 ms | 52 MB |
| g++ | 21_fixed_length_01 |
|
58 ms | 52 MB |
| g++ | 21_fixed_length_02 |
|
58 ms | 52 MB |
| g++ | 22_fixed_length_00 |
|
76 ms | 51 MB |
| g++ | 22_fixed_length_01 |
|
78 ms | 52 MB |
| g++ | 22_fixed_length_02 |
|
75 ms | 50 MB |
| g++ | 23_fixed_length_00 |
|
71 ms | 53 MB |
| g++ | 23_fixed_length_01 |
|
70 ms | 52 MB |
| g++ | 23_fixed_length_02 |
|
69 ms | 53 MB |
| g++ | 24_fixed_length_00 |
|
64 ms | 53 MB |
| g++ | 24_fixed_length_01 |
|
63 ms | 52 MB |
| g++ | 24_fixed_length_02 |
|
64 ms | 51 MB |
| g++ | 30_mixed_length_00 |
|
76 ms | 54 MB |
| g++ | 30_mixed_length_01 |
|
75 ms | 51 MB |
| g++ | 30_mixed_length_02 |
|
75 ms | 51 MB |
| g++ | 30_mixed_length_03 |
|
72 ms | 51 MB |
| g++ | 30_mixed_length_04 |
|
75 ms | 53 MB |
| g++ | 90_challenge_00 |
|
17 ms | 7 MB |
| g++ | 90_challenge_01 |
|
78 ms | 6 MB |
| g++ | 90_challenge_02 |
|
14 ms | 7 MB |
| g++ | 90_challenge_03 |
|
45 ms | 5 MB |
| g++ | 90_challenge_04 |
|
18 ms | 9 MB |
| g++ | 90_challenge_05 |
|
2 ms | 4 MB |