Advertisement
dipBRUR

11

Nov 19th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. Algo : Aho-Corasick
  2.  
  3. void solve() {
  4. build_trie();
  5. aho_corasick();
  6. for (int q = 0; q < tQuery; q++) {
  7. NODE *p = root;
  8. for (char ch : dictinary[q]) {
  9. int v = ch - '0';
  10. p = p->next[v];
  11. }
  12. cout << dfs(p) << endl;
  13. }
  14. delete root;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement