随笔分类 - 1.0 动态规划
1
摘要:题面 https://www.luogu.org/problem/P3158 题解 首先,对于此题,不同的行列之间应该是独立的(因为每一行每一列只能放一种颜色) 一些同色棋子对它们所在的行和列是支配的关系。 设$F[i][j][k]$为考虑了前$i$种颜色,它们支配了$i$行$j$列的方案数。(这里
阅读全文
摘要:题面 https://www.luogu.org/problem/P3687 题解 如果原图不是仙人掌(在这里,我们认为一棵树也是一个仙人掌),则无解,输出$0$。 如果原图是一个仙人掌,加的边是不能跨越仙人掌上的环边的(若跨越,则仙人掌上的环边被$2$个环所有,不是仙人掌),所以我们直接把环边断掉
阅读全文
摘要:题面 https://www.luogu.org/problem/P1273 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P1987 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P5017 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P1144 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P3959 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P2634 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P2577 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P2495 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P2704 题解 状态压缩$dp$的经典题了吧。 因为直接压压不动,所以我写的是$hash$+记忆化。
阅读全文
摘要:题面 https://www.luogu.org/problem/P4363 题解 很套路的$hash$状态$+dp$。 可知棋子形成的形状一定是一个连续的倒楼梯形(楼梯向右延伸的长度可以不连续,但一定单调) $hash$轮廓就行了。
阅读全文
摘要:题面 https://www.luogu.org/problem/P2607 题解 这道题让我回想起了省选前被$aysn$吊打的故事。 本应该用$tarjan$找环,但是我当年太弱了,写的并查集找环。 最大独立集$dp$(当年我连最大独立集$dp$都不会。说不定现在也不会呢)。
阅读全文
摘要:题面 https://www.luogu.org/problem/P5516?contestId=20135 先说一下我在考场做的情况。 首先,大体方向掌握的很好:只对指定的颜色分析由它“统一”的概率和它“统一”的期望次数。 期望次数我是用矩阵快速幂逼近的。 用游走的模型,每个点向左右两个点连边,终
阅读全文
摘要:题面 https://www.luogu.org/problem/P1666 题解 这道题有点搞笑啊。 把单词插入到$trie$树上,对于$trie$树上的一个节点,设$f[x]$是这下面的所有单词节点的方案,有两种转移,一种是他不选,他的儿子自由组合,第二种是它选,它的儿子全都不选。 黑科技:$m
阅读全文
摘要:题面 https://www.luogu.org/problem/P1070 题解
阅读全文
摘要:题面 https://www.luogu.org/problem/P1772 题解
阅读全文
摘要:题面 https://www.luogu.org/problemnew/show/P4517 题解 这道题对我来说意义重大,是我花了很长时间独立完成的dp。 分析题目 给出一个仙人掌,对于一个点集$S$,把原图中使他联通的最小的边集记做$H(S)$, 求$\sum_{S \subseteq V} |
阅读全文
摘要:题面 https://www.luogu.org/problemnew/show/P4410 题意:求仙人掌上最大独立集。
阅读全文
摘要:题面 http://darkbzoj.tk/problem/1023
阅读全文
1

浙公网安备 33010602011771号