摘要: 暴力搜索加剪枝~ 看的人好多...更新一下: 这道题的正解应该是求最大团之类的...暴力搜索是拿不到分的,我用了好几种奇怪的技巧用爆搜卡掉了。。。 #include<bits/stdc++.h> using namespace std; const int maxn=1014; const int 阅读全文
posted @ 2020-02-13 12:03 zlc0405 阅读(640) 评论(0) 推荐(0) 编辑
摘要: 暴力搜索加剪枝,二进制保存状态,set去重~ #include<bits/stdc++.h> using namespace std; const int maxn=7; string s[maxn]; struct node { int x,y; }Node[100]; int N,M,K,H; 阅读全文
posted @ 2020-02-13 12:02 zlc0405 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 动态规划找最长上升子序列,正反遍历一遍序列即可~ #include<bits/stdc++.h> using namespace std; const int maxn=10010; int N; int a[maxn]; int l[maxn]; int r[maxn]; int main () 阅读全文
posted @ 2020-02-13 12:01 zlc0405 阅读(144) 评论(0) 推荐(0) 编辑
摘要: dfs判断连通块的数量,prim算法建立最小生成树并判断是否唯一~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; const int inf=1e9; int g[maxn][maxn]; int d[maxn]; 阅读全文
posted @ 2020-02-13 11:40 zlc0405 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 双下标法找最长公共子序列(不能删除字符) #include<bits/stdc++.h> using namespace std; const int maxn=1014; string s; string t; int main () { cin>>s>>t; int maxLength=0; i 阅读全文
posted @ 2020-02-13 11:38 zlc0405 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 大水题,dfs判连通块的数量,bfs每个点找朋友圈的最大直径~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; vector<int> g[maxn]; bool visit[maxn]; int N; int ma 阅读全文
posted @ 2020-02-13 11:37 zlc0405 阅读(150) 评论(0) 推荐(0) 编辑
摘要: krustral算法加并查集,按题给要求维护并查集~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; const int inf=1e9; int N,M,x,y; int c,w; struct edge { in 阅读全文
posted @ 2020-02-13 11:35 zlc0405 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 直接暴力枚举,注意每次深搜完状态的还原~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; int visit[maxn][maxn]; int N,M,x,y; int cnt; int maxcnt; int X[ 阅读全文
posted @ 2020-02-13 11:33 zlc0405 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 大模拟题,按要求建立多边形,先定位斜边的位置,再分类讨论~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; struct node { double x,y; }Node[2][maxn]; double dista 阅读全文
posted @ 2020-02-13 11:32 zlc0405 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 跟1009几乎是同一道题~ #include<bits/stdc++.h> using namespace std; const int maxn=1e6+14; int a[maxn]; int c[maxn*8]; int r[maxn]; int lowbit (int x) { return 阅读全文
posted @ 2020-02-13 11:30 zlc0405 阅读(132) 评论(0) 推荐(0) 编辑