摘要: ##题目传送门 记忆化搜索,以每个不为负数的花为根,向外扩展,找最大联通块. #include<iostream> #include<cstdio> #include<cstring> #include<map> using namespace std; int n,a[16001],tot,hea 阅读全文
posted @ 2020-09-13 22:48 Mr^Simon 阅读(148) 评论(0) 推荐(0) 编辑
摘要: ##题目传送门 树形dp,$f_{i,j}$表示以i为根,子树删j条边的最少苹果数 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int n,q,head[101],si[101],m,pp,an 阅读全文
posted @ 2020-09-13 22:43 Mr^Simon 阅读(77) 评论(0) 推荐(0) 编辑
摘要: ##题目传送门 一道dp,但我没推出方程,只好写记忆化搜索+剪枝. 主要说一下为什么从小到大排序,如果大的块被选择且最终得出符合题意的答案,那么后面很多状态都会被剪掉,因为答案越搜越小(应该是). #include<iostream> #include<cstdio> #include<cstrin 阅读全文
posted @ 2020-09-13 21:11 Mr^Simon 阅读(80) 评论(0) 推荐(1) 编辑