随笔分类 -  板子 / 动态规划dp

摘要:https://codeforces.com/contest/1950/problem/G 在非连通图上找到一条包含点最多的路径,dp数组维护可达性 // Problem: G. Shuffling Songs // Contest: Codeforces - Codeforces Round 93 阅读全文
posted @ 2024-03-29 16:05 potential-star 阅读(48) 评论(0) 推荐(0)
摘要:请你在树中找到一个点,使得该点到树中其他结点的最远距离最近。这个点被称为树的中心。 题解:https://www.cnblogs.com/dx123/p/17302104.html 评测:https://www.acwing.com/problem/content/1075/ 暴力做法是以每个点为根 阅读全文
posted @ 2023-12-05 22:00 potential-star 阅读(78) 评论(0) 推荐(1)
摘要:无限制最长连续的子序列和 https://www.acwing.com/problem/content/description/1481/ dp[i]=max(dp[i-1]+a[i],a[i]); 最终结果也就是在dp数组线性扫描找出最大值 int pos=max_element(dp+1,dp+ 阅读全文
posted @ 2023-11-28 21:28 potential-star 阅读(65) 评论(0) 推荐(0)