摘要: 分组背包 输出方案可以跟最短路输出路径进行类比 #背包DP输出方案—拓扑图分析 #include<bits/stdc++.h> using namespace std; #define fr first #define se second typedef pair<int, int> PII; ty 阅读全文
posted @ 2022-06-27 23:23 xhy666 阅读(26) 评论(0) 推荐(0)
摘要: 二进制优化转化成01背包的复杂度为 O(n logm * m) (m为背包容量),大概是2 * 1e8的数量级,一般会超时 发现如果以j(0 <= j <= m)模上v的余数分类,相当于求固定区间的最大值(滑动窗口),可以用单调队列优化,复杂度为 O(n * m) #include<bits/std 阅读全文
posted @ 2022-06-27 16:56 xhy666 阅读(39) 评论(0) 推荐(0)