摘要:
Indie Album 我的写法是对询问串建ac自动机, 原来的串建trie图, 然后两边同时跑, 最后dsu on tree + bit 统计。。 其实可以不用这么麻烦, 我们把原串和询问串一起建一个ac自动机, 那么对一个一个串有贡献的在 fail树的子树里, 所以只要在trie图上dfs一下, 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; const int N = (int)2e5 + 7; const int inf = 0x3f3f3f3f; int n, m, q, w[N], pa[N], depth[N]; vector<int> G[N], G2[N]; multiset<int> mulset[N]; int sz[N], so 阅读全文