2023年2月20日
摘要: #include <iostream> #include <map> #include <algorithm> #include <cstring> using namespace std; const int N =203 ,M =N; typedef long long ll; int n,m, 阅读全文
posted @ 2023-02-20 18:46 towboat 阅读(18) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std ; const int N=1600,M=5*N; int n,in[N],nxt[M],go[M],hd[N],all=1,f[N][2]; void add(int x,int y){ go[++all]= 阅读全文
posted @ 2023-02-20 17:48 towboat 阅读(24) 评论(0) 推荐(0)
摘要: https://www.luogu.com.cn/problem/P4302 求字符串的最短折叠 AAAAAAAAAABABABCCD 的最短折叠为: 9(A)3(AB)CCD。 #include <iostream> #include <cstring> #include <algorithm> 阅读全文
posted @ 2023-02-20 17:31 towboat 阅读(16) 评论(0) 推荐(0)
摘要: 多重背包及优化 #include <bits/stdc++.h> using namespace std ; const int N=5e5+10; int c[N],S,n,f[N]; int solve(){ int i,j; S=0; memset(f,0,sizeof f); int fla 阅读全文
posted @ 2023-02-20 17:09 towboat 阅读(12) 评论(0) 推荐(0)
摘要: 类似背包 f[i][sum] |= f[i-1][sum-a[i] ] ,这里设置为1或-1 #include <bits/stdc++.h> using namespace std ; const int N=2e4+10; const int D=1e4; int n,m,a[N],f[102] 阅读全文
posted @ 2023-02-20 16:02 towboat 阅读(30) 评论(0) 推荐(0)