摘要: 题目链接 "luoguP3871 [TJOI2010]中位数" 题解 平衡树 代码 c++ include include include include define LL long long inline int read() { int x = 0,f = 1;char c = getchar 阅读全文
posted @ 2018-07-05 21:34 zzzzx 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "luogu P2439 [SDOI2005]阶梯教室设备利用" 题解 dp 代码 c++ include include include include define LL long long inline int read() { int x = 0,f = 1;char c = ge 阅读全文
posted @ 2018-07-05 20:01 zzzzx 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj1559: [JSOI2009]密码" 题解 构造长度为n包含所有模式串的的串,求方案数 构造AC自动机的trie图 对于模式串可以装压dp 设dp[i][j][s]表示位于字符串第i位,位于trie图上的第j个节点,状态为s方案数 转移边为trie图 考虑ans include 阅读全文
posted @ 2018-07-05 19:59 zzzzx 阅读(214) 评论(0) 推荐(1) 编辑
摘要: 题目链接 "bzoj3172: [Tjoi2013]单词" 题解 在插入单词时对于每个点都标记一下 构建fail树 因为AC自动机节点维护前缀,fail树的关系是公共后缀,那么可以发现,答案就是该单词的fail子树总价值 代码 c++ include include include include 阅读全文
posted @ 2018-07-05 19:55 zzzzx 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj1196: [HNOI2006]公路修建问题" 、 题解 二分,判断能否连通 代码 c++ include include include include define LL long long inline int read() { int x = 0,f = 1;char c 阅读全文
posted @ 2018-07-05 19:53 zzzzx 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj2660: [Beijing wc2012]最多的方案" 题解 对于一个数的斐波那契数列分解,他的最少项分解是唯一的 我们在拆分成的相临两项之间分解后者,这样形成的方案是最优且不重的 我们可以把它的分解某一项拆分 设dp[i][1/0]表示 对于最少拆分成的第i项斐波那切数拆不拆 阅读全文
posted @ 2018-07-05 19:51 zzzzx 阅读(119) 评论(0) 推荐(0) 编辑