随笔分类 -  动态规划--状压dp / 插头dp

2019.7.13 模拟赛——[ 置换 ][ 关于“平方”的思路+插头DP ]
该文被密码保护。

posted @ 2019-07-13 16:52 Narh 阅读(0) 评论(0) 推荐(0)

2019.6.25模拟赛——[ 树上贪心选链 ][ 思路+差分思想+状压DP ]
该文被密码保护。

posted @ 2019-06-25 10:33 Narh 阅读(1) 评论(0) 推荐(0)

LOJ 6433 「PKUSC2018」最大前缀和——状压DP
摘要:题目:https://loj.ac/problem/6433 想到一个方案中没有被选的后缀满足 “该后缀的任一前缀和 <=0 ”。 于是令 dp[ S ] 表示选了点集 S ,满足任一前缀和 <=0 的方案。很好转移。 令 f[ S ] 表示选了点集 S ,且 S 整体就是最大前缀和的方案。 只会 阅读全文

posted @ 2019-05-22 09:02 Narh 阅读(218) 评论(0) 推荐(0)

2019 TCO Round 1B——[ 状压DP ]
摘要:第一题是 EllysSki 。 题意:给n个数,求两个方向的最长递减区间。 可以O(n)。 #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using namespace std; int Mx(int 阅读全文

posted @ 2019-05-02 00:52 Narh 阅读(190) 评论(0) 推荐(0)

bzoj 1814 Ural 1519 Formula 1 ——插头DP
摘要:题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1814 普通的插头 DP 。但是调了很久。注意如果合并两个 1 的话,不是 “把向右第一个 2 该成 1 ”,而是 “把向右第一个没有与 1 匹配的 2 改成 1 ”。 原来获取哈希值是用字符串 阅读全文

posted @ 2019-04-17 22:22 Narh 阅读(125) 评论(0) 推荐(0)

hdu 1693 Eat the Trees——插头DP
摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1693 第一道插头 DP ! 直接用二进制数表示状态即可。 阅读全文

posted @ 2019-04-15 21:04 Narh 阅读(149) 评论(0) 推荐(0)

51nod 1673 树有几多愁——虚树+状压DP
摘要:题目:http://www.51nod.com/Challenge/Problem.html#!#problemId=1673 建一个虚树。 一种贪心的想法是把较小的值填到叶子上,这样一个小值限制到的叶子比较少。 但不太会贪心了,所以考虑 DP 。只有 20 个叶子,(不是用来暴搜的!)可以状压DP 阅读全文

posted @ 2019-02-25 16:34 Narh 阅读(147) 评论(0) 推荐(0)

UOJ 348 【WC2018】州区划分——子集卷积
摘要:题目:http://uoj.ac/problem/348 参考:https://www.cnblogs.com/NaVi-Awson/p/9242645.html#%E5%AD%90%E9%9B%86%E5%8D%B7%E7%A7%AF FMT就是快速莫比乌斯变换/反演,解决或卷积的问题,和 FWT 阅读全文

posted @ 2019-01-12 10:23 Narh 阅读(276) 评论(0) 推荐(0)

洛谷 3112 [USACO14DEC]后卫马克Guard Mark——状压dp
摘要:题目:https://www.luogu.org/problemnew/show/P3112 状压dp。发现只需要记录当前状态的牛中剩余承重最小的值。 阅读全文

posted @ 2018-07-30 00:35 Narh 阅读(202) 评论(0) 推荐(0)

poj 2288 Islands and Bridges——状压dp(哈密尔顿回路)
摘要:题目:http://poj.org/problem?id=2288 不知为什么记忆化搜索就是WA得不得了! #include<iostream> #include<cstdio> #include<cstring> #define ll long long using namespace std; 阅读全文

posted @ 2018-07-27 18:26 Narh 阅读(205) 评论(0) 推荐(0)

导航