9250번: 문자열 집합 판별 - Aho-Corasick
Aho-Corasick 기본 문제.#include using namespace std;typedef long long ll;typedef pair pii;typedef pair pll;typedef tuple tiii;const int MAXTR = 100001;const int MAXAL = 26;int N, M;int node = 1;int trie[MAXTR][MAXAL];bool exist[MAXTR];int fail[MAXTR];int root = 0;queue qu;int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); memset(trie, -1, sizeof(trie)); memset(fail, -1, si..
알고리즘/baekjoon
2024. 8. 12. 12:27