上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 54 下一页
  2022年11月4日
摘要: 题意和<没有上司的舞会> 一样,多了点东西:每颗树(总体为森林)上多一个环,问最大权值和 基环树,考虑把这种图去掉一条边,就变成树,然后dp 然后考虑这条去掉的边的影响: 两条边的端点x,y,不能都选 那么做法就是 取 f[x][0], f[y][0] 分别进行dp #include <iostre 阅读全文
posted @ 2022-11-04 11:41 towboat 阅读(18) 评论(0) 推荐(0)
  2022年11月3日
摘要: 一棵有点权的树,选择一些点, 使得每个点至少满足下列中的一个: 1.已被选择 2.父亲被选择 3.子节点至少有一个被选择 求点权和最小值 f[x][0]=SUM{ min(f[y][1],f[y][2] } f[x][2] = SUM { min(f[y][0],f[y][1],f[y][2]) } 阅读全文
posted @ 2022-11-03 21:27 towboat 阅读(17) 评论(0) 推荐(0)
  2022年11月2日
摘要: 有 NN 块木板从左到右排成一行,有 MM 个工匠对这些木板进行粉刷,每块木板至多被粉刷一次。 第 ii 个木匠要么不粉刷,要么粉刷包含木板 Si 的,长度不超过 Li 的连续的一段木板,每粉刷一块可以得到 Pi 的报酬。 如何安排能使工匠们获得的总报酬最多 #include <iostream> 阅读全文
posted @ 2022-11-02 18:42 towboat 阅读(14) 评论(0) 推荐(0)
摘要: 序列A,选择一些a[i] , 任意一个长度为m的区间内至少有一个所选的 问 sum{ a[i] } 的最小值 #include <iostream> #include <cstring> using namespace std; const int N=2e5+5; int a[N],n,m,f[N 阅读全文
posted @ 2022-11-02 08:52 towboat 阅读(28) 评论(0) 推荐(0)
摘要: 有 n 道题目要抄,耗时a[i] 。用不超过 t分钟抄这个,每道题要么不写,要么抄完,。 下标连续的一些空题称为一个空题段,它的长度就是所包含的题目数。 现在,小 Y 想知道他在这 t 分钟内写哪些题,才能够尽量减轻马老师的怒火( 连续空题段的最大值 ) #include <iostream> #i 阅读全文
posted @ 2022-11-02 00:13 towboat 阅读(94) 评论(0) 推荐(0)
  2022年11月1日
摘要: 长度为n 的整数序列 要求从中找出一段连续的长度不超过m的子序列,使得这个序列的和最大 #include <iostream> using namespace std; const int N=2e5+3; #define int long long int a[N],s[N],f[N],n,m; 阅读全文
posted @ 2022-11-01 15:10 towboat 阅读(280) 评论(0) 推荐(0)
摘要: FJ 有 n 只奶牛,奶牛 i的效率为 a[i]。 选一些奶牛放到n个格子上且 连续的奶牛不能超过K只。 计算 FJ 可以得到的最大效率 #include <iostream> using namespace std; const int N=2e5+3; #define int long long 阅读全文
posted @ 2022-11-01 15:09 towboat 阅读(138) 评论(0) 推荐(0)
摘要: 通过一段时间的观察,预测到了未来 n天内某只股票的走势,第 i 天的股票买入价为每股 a[i]​,第 ii 天的股票卖出价为每股 b[i] (a[i]>=b[i]), 规定第 ii 天的一次买入至多只能购买 as[i]​ 股,一次卖出至多只能卖出 bs[i] 股。 规定在两次交易(某一天的买入或者卖 阅读全文
posted @ 2022-11-01 12:57 towboat 阅读(30) 评论(0) 推荐(0)
  2022年10月31日
摘要: n^3 #include <iostream> #include <algorithm> #include<cstring> #include <vector> using namespace std; const int N=600; int n,m,a[N],b[N],p[N][N],f[N][ 阅读全文
posted @ 2022-10-31 23:02 towboat 阅读(20) 评论(0) 推荐(0)
摘要: 01背包,这题设计状态f[i][j] 为刚好用完时间 j 时的歌曲数,这样方便找到用时(初始化设置一下就好 #include <iostream> #include <algorithm> #include<cstring> using namespace std; const int N=53,M 阅读全文
posted @ 2022-10-31 20:04 towboat 阅读(16) 评论(0) 推荐(0)
上一页 1 ··· 38 39 40 41 42 43 44 45 46 ··· 54 下一页