上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 54 下一页
  2023年2月20日
摘要: #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)
  2023年2月19日
摘要: 给n*n的方格图铺满1*2 的长条,且某些位置不能铺,问最多能放多少个长条 #include <iostream> #include<queue> #include <vector> #include <cstring> using namespace std; const int N =110 , 阅读全文
posted @ 2023-02-19 19:43 towboat 阅读(22) 评论(0) 推荐(0)
摘要: 二分图最大匹配 1.匈牙利算法: 做法是 u 尽量 匹配 v , 如果v已有配对 y,就重新配对 y https://www.luogu.com.cn/record/128670058 2. 网络流解决 性质: 最大独立集= 点数-最大匹配 最小顶点集覆盖数= 最大匹配 阅读全文
posted @ 2023-02-19 15:30 towboat 阅读(17) 评论(0) 推荐(0)
摘要: 无向图一笔画需要多少次(欧拉路径的条数) 答案:奇数点的个数 / 2 这题需要维护联通块,用并查集即可 #include <iostream> #include <algorithm> #include <cstring> #include <stack> using namespace std ; 阅读全文
posted @ 2023-02-19 15:02 towboat 阅读(23) 评论(0) 推荐(0)
摘要: 求一个无向图的欧拉回路,但要求每条边正反过一次 当作有向图,打标记只打一条边 #include <iostream> #include <algorithm> #include <cstring> #include <stack> using namespace std ; const int N= 阅读全文
posted @ 2023-02-19 14:01 towboat 阅读(13) 评论(0) 推荐(0)
  2023年2月18日
摘要: 求欧拉回路( dfs ) #include <bits/stdc++.h> using namespace std ; const int N=1e6+3,M=2e6+3; inline int read(){ int res = 0, flag = 1; char ch = getchar(); 阅读全文
posted @ 2023-02-18 21:14 towboat 阅读(134) 评论(0) 推荐(0)
摘要: 板子题 缩点找出入度为0的点 即可 第二问 max(p,q) #include <bits/stdc++.h> using namespace std ; const int N=103; vector<int> g[N],graph[N]; int n,pool,dfn[N],low[N],in[ 阅读全文
posted @ 2023-02-18 19:58 towboat 阅读(161) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 54 下一页