夏夜、

心若平似镜、何题不AC。

2013年11月9日

uvalive 6343 - Dyslexic Gollum AC自动机

摘要: 一开始完全看不出这是AC自动机啊。求长度为T且不包含长度大于K的回文串的二进制串有多少种。枚举长度为K和K+1的全部回文串,保存在tire里面,然后构造自动机DP因为长度>k+1的肯定也包含这些长度为K或K+1的。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing names 阅读全文

posted @ 2013-11-09 01:05 BMan、 阅读(267) 评论(0) 推荐(0) 编辑

ZOJ 3686 A Simple Tree Problem 线段树

摘要: 如果把一颗树跑一遍拓扑排序,会发现每颗子树都在一个区间里。那么对子树的操作就变成对区间的操作。#include#include#include#include#includeusing namespace std;const int MAXN=100100;int n,m;int t;int id[MAXN];int num[MAXN];vector g[MAXN];int calnum(int u){ int x=1; for(int i=0;i>1; flag[idx=r) { flag[idx]^=1; sum[idx]=r-l... 阅读全文

posted @ 2013-11-09 00:42 BMan、 阅读(172) 评论(0) 推荐(0) 编辑

POJ 1625 Censored! AC自动机+DP+大数

摘要: //#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) push_back(a)#defin 阅读全文

posted @ 2013-11-09 00:31 BMan、 阅读(110) 评论(0) 推荐(0) 编辑

POJ 2411 Mondriaan's Dream 状态DP

摘要: //#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) push_back(a)#defin 阅读全文

posted @ 2013-11-09 00:27 BMan、 阅读(190) 评论(0) 推荐(0) 编辑

hdu 2825 Wireless Password AC自动机+状态DP

摘要: 时间卡得紧,写成递推可以做一些优化//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) p 阅读全文

posted @ 2013-11-09 00:23 BMan、 阅读(151) 评论(0) 推荐(0) 编辑

导航