摘要:
两个月前写的模板,忘记存blog了 prim #include<cstdio> #include<algorithm> using namespace std; const int maxn=2e5+5; int n, m, f[maxn][maxn],tot,dis[maxn],s; bool v 阅读全文
摘要:
https://www.luogu.com.cn/problem/P2340 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; int dp[800005]; int main() { int n, 阅读全文
摘要:
和原板子区别不大,更符合我的代码习惯 #include<cstdio> #include<algorithm> #include<cstring> #include<queue> using namespace std; const int maxn = 2e5+5; int n, m, head[ 阅读全文
摘要:
二进制优化用于多重背包中。 (1)多重背包模板: long long dp[maxn], n, W, v[maxn], w[maxn], m[maxn]; //n是物品种类,W是背包总容量,v[i]是第i种物品的价值,w[i]是第i种物品的重量,m[i]是第i种物品的件数 for(int i = 1 阅读全文