
序列自动机
stargazer.
夜を穿つの
展开
-
【洛谷P4112】【HEOI2015】—最短不公共子串(序列自动机+后缀自动机+DP)
传送门对2个串分别建出SamSamSam和序列自动机对四种情况分别跑一次n2dpn^2dpn2dp即可#include<bits/stdc++.h>using namespace std;const int RLEN=1<<20|1;inline char gc(){ static char ibuf[RLEN],*ib,*ob; (ob==ib...原创 2019-09-27 18:02:37 · 151 阅读 · 0 评论 -
【洛谷P4608】【FJOI2016】—所有公共子序列问题(序列自动机+DP+高精度)
传送门对两个串建出序列自动机之后直接n2dpn^2dpn2dp即可由于答案很大,需要写个高精度由于答案很大,要写压位高精,否则会TTT由于空间直接开不下,于是写了个mapmapmap存状态由于出题人很神奇,输出方案的话必须要在开头输出一个空串#include<bits/stdc++.h>using namespace std;const int RLEN=1<&l...原创 2019-09-27 18:05:57 · 165 阅读 · 0 评论 -
【51Nod 2504】—是子序列的个数(序列自动机)
传送门模板题建出序列自动机之后暴力匹配即可#include<bits/stdc++.h>using namespace std;const int RLEN=1<<20|1;inline char gc(){ static char ibuf[RLEN],*ib,*ob; (ob==ib)&&(ob=(ib=ibuf)+fread...原创 2019-09-27 18:08:04 · 275 阅读 · 0 评论