07 2021 档案
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=14&page=show_problem&problem=1212 首先发现,最短的两只筷子一定是相邻的,如果不是,换成相邻的答案一定
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=242&page=show_problem&problem=3245 有些麻烦的树形 \(dp\) #include<bits/std
阅读全文
摘要:###题目链接: 保证不出现长度为 \(k\) 和 \(k+1\) 的回文串即可 状压 \(dp\),令 \(dp[i][s]\) 表示长度为 \(i\) 的串,第 \(i\) 位之前的 \(k\) 位为 \(s\) 的方案数 预处理出长度为 \(k\) 和 \(k+1\) 的回文串转移即可 #in
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4505 没有看出这是一道区间 \(dp\) 可以将串 \(S\) 分成 \(AB\) 两部分,一种
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1664 考察对于 \(LCS\) 的理解,最短字符串肯定是两串长度减去 \(LCS\) 的长度,而
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1758 设 \(dp[i][s1][s2]\) 表示前 \(i\) 个人,被恰好一个人教的课程集合
阅读全文
摘要:###题目链接:https://www.luogu.com.cn/problem/P4933 ###题目大意: 给定一列数字 \(a[i]\),求有多少个等差子序列,其中一个数字和两个数字也算等差数列。 ###题解:设 \(dp[i][j]\) 表示以 \(a[i]\) 结尾,公差为 \(j\) 的
阅读全文
摘要:###题目链接:https://www.luogu.com.cn/problem/P1282 每个骨牌都有翻转或不翻转两种状态,体积分别为 \(a[i]-b[i]\) 和 \(b[i]-a[i]\) 可以为负,代价分别为 \(0\) 和 \(1\),最终要求使体积绝对值最小的代价最小 设 \(dp[
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4502 ###题目大意: 将 \(n\) 个人分成两组,每组的人互相认识,每个人都在一个组中,且每
阅读全文
摘要:题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=4501&mosmsg=Submission+received+with+ID+26
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=2631&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2395 要换灯泡的话,一定是这个种类的全换,将灯泡按电压排序,如果有灯的种类要替换成灯 \(i\)
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=52&mosmsg=Submission+received+with+ID+2
阅读全文
摘要:###题目链接: 一个人走过去走回来不好考虑,可以看成两个人同时从起点出发,\(dp[i][j]\) 表示第一个人在 \(i\), 第二个人在 \(j\) 时,\(1\) 到 \(max(i,j)\) 的点都走过时的最短距离,因为 \(dp[i][j]\) 和 \(dp[j][i]\) 相同,所以规
阅读全文
摘要:树形背包是背包中的一类问题,俗称有依赖的背包问题 我将树形背包总结为以下几类: ###一种状态组内转移 选课:https://www.luogu.com.cn/problem/P2014 有线电视网:https://www.luogu.com.cn/problem/P1273 二叉苹果树:https
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=2473&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=2031&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=1478&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=4162&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=1858&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=2369&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=4137&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=545&page=show_problem&problem=3587 要求相隔最短的着陆时间的最大值,二分答案,如果相邻两个飞机之间着
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=2299&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=3549&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=4169&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=995&mosmsg=Submission+received+with+ID+
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=988&mosmsg=Submission+received+with+ID+
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=2671&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题目链接:https://www.luogu.com.cn/problem/P1600 参考题解:https://www.cnblogs.com/lfyzoi/p/10221884.html 转换思路,枚举每个观察员,统计有哪些运动员会给观察员做贡献。因为给观察员做贡献的运动员都在观察员的子树
阅读全文
摘要:###题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5293 \(sum[u]\) 表示子树 \(dp\) 值的和,\(dp[u]\) 表示子树 \(u\) 的答案,这里我用 \(dp[u][0]\) 表示 \(sum\), \(dp[u][1]\)
阅读全文
摘要:###题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=4110&mosmsg=Submission+received+with+ID
阅读全文
摘要:###题面描述: 这是一个无向图上的游戏,Alice 和 Bob 轮流操作,Alice 先走。第一次可以任选一个点放一枚棋子,以后每次把棋子移动到一个相邻点上,并把棋子原先所在的点删除,谁不能移动就算输。若双方都采取最优策略,谁将取胜? ###题解: 如果有完美匹配,则 Alice 输,Alice
阅读全文
摘要:##题目链接:http://poj.org/problem?id=2777 颜色数量很少,所以状压进 \(int\),线段树维护即可 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; typedef
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=4535&mosmsg=Submission+received+with+ID+
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=3442&mosmsg=Submission+received+with+ID+
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=3892&mosmsg=Submission+received+with+ID+
阅读全文
摘要:题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=1676&mosmsg=Submission+received+with+ID+26
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=4261&mosmsg=Submission+received+with+ID+
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4095 由于每个点只属于一个有向圈,也就是每个点都只有一个唯一的后继 反之,每个点都有一个唯一的后继
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=4533&mosmsg=Submission+received+with+ID+
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=2023&mosmsg=Submission+received+with+ID+
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3466 \(dp[i][j]\) 表示时间 \(i\) 在站点 \(j\) 时最少需要等待的时间 每
阅读全文
摘要:到达一个点后讨论是否需要等待即可,需要等待则加上等待的时间 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn = 50010; i
阅读全文
摘要:##题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=694&mosmsg=Submission+received+with+ID+2
阅读全文
摘要:题目链接:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=183 求出传递闭包,知道两个人之间能否直接或间接互相联系,如果能互相联系则在一个电话圈里,建新图输出每个
阅读全文
摘要:##题目链接 先求出不买套餐的最小生成树的边 然后枚举选择哪些套餐,将套餐中的边权置为 \(0\), 和原先最小生成树的边重新进行 \(kruscal\) 而原先选不到的边,权值大于套餐和最小生成树的边,后来一定也选不到 #include<bits/stdc++.h> using namespace
阅读全文
摘要:题目链接 https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=0&problem=3371&mosmsg=Submission+received+with+ID+26
阅读全文

浙公网安备 33010602011771号