分类 动态规划 下的文章
- 首页
- 动态规划
Codeforces - 1155D - Beautiful Array
地址https://codeforces.com/contest/1155/problem/D原文地址https://www.lucien.ink/archives/420/题意你有一个长为 $n$ 的序列,你可以选择一个子区间(可以为空),将这个子区间所有的元素乘以 $x$ ,问做完上述操作之后这个序列的最大连续区间和可以是多少。题解记状态为 f[i][status] ,其中 $statu...
Codeforces - 1153D - Serval and Rooted Tree
地址https://codeforces.com/contest/1153/problem/D原文地址https://www.lucien.ink/archives/416代码https://pasteme.cn/6251#include <bits/stdc++.h> const int maxn = int(3e5) + 7; std::vector<int> e...
Codeforces - 1139D - Steps to One
地址https://codeforces.com/contest/1139/problem/D原文地址https://www.lucien.ink/archives/409题意模拟一个循环,一开始有一个空序列,之后每次循环:从 $[1, m]$ 中等概率选出一个数字添加到序列里去。检查这个序列所有元素的 $gcd$ 是否为 $1$,如果为 $1$ 则停止,若否则重复 $1$ 操作直至 $gc...