图论专题
文章平均质量分 62
renxinyu2002
虽然我们走不了最短路,但图依然是连通图
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
佳佳的魔法药水(好题,不过很神)
//话说为什么是vis[j]????难道我dijkstra没学好?? #include #include #include #include using namespace std; const int maxn=1e3+10; int n,vis[maxn],ans[maxn],dis[maxn],a[maxn], nxt[maxn],cnt,head[maxn],d[maxn]原创 2017-10-27 07:15:38 · 337 阅读 · 0 评论 -
繁忙的都市(最小生成树模板)
#include #include #include #include using namespace std; const int maxm=50010; int n,m,a[maxm],maxx,head[2*maxm],fa[310],v[2*maxm],nxt[2*maxm],cnt,w[2*maxm]; int find(int x){ return fa[x]==原创 2017-11-09 16:01:59 · 396 阅读 · 0 评论 -
二分图匹配模板
// 匈牙利算法 #include #include #include #include using namespace std; const int maxn=1010; int n,m,vis[maxn],l[maxn],a[maxn][maxn],x,y,k,tot=0; bool dfs(int x){ for(int i=1;i if(a[x][i]&&!vis原创 2017-11-08 16:49:54 · 265 阅读 · 0 评论 -
广元外国语的模拟赛(最短路)
#include #include #include #include #include using namespace std; const int maxn=1e4+10; struct node{ int cur,dis,kk; }; priority_queue q; int n,m,k,s,t,a,b,c,head[2*maxn], vis[2*maxn][1原创 2017-11-07 15:24:28 · 274 阅读 · 0 评论 -
loj模拟赛t1
//水题,二十分钟绝对应该搞定...而我搞了四十分钟,就是小模拟而已 #include #include #include #include #include using namespace std; typedef long long ll; const int maxn=5000010; ll n,k,vis[2000010]; char s[maxn]; int mai原创 2017-11-07 14:35:36 · 301 阅读 · 0 评论 -
libreoj模拟赛day2t1
// 本次模拟赛的最大成功之处在于把两天模拟赛的t1都a掉了,尤其day2t1,有些难度,是个惊喜,失败之处在于,暴力分一点都没拿到 #include #include #include #include using namespace std; typedef long long ll; const int mod=2000000; const int maxn=510; in原创 2017-11-07 14:33:55 · 248 阅读 · 0 评论 -
最短路模板(dij+spfa)
/*#include #include #include #include #include using namespace std; const int maxn=10010; const int maxm=5*1e5+10; // n-ans,m-ans,n+m-ans; // 二分图匹配,骗分; struct node{ int dis,cur; }s[m原创 2017-10-29 22:24:43 · 328 阅读 · 0 评论 -
刻录光盘
#include #include #include #include using namespace std; const int maxn=210; int f[maxn][maxn],n,d[maxn]; int main(){ scanf("%d",&n); for(int i=1;i for(int j=1;j if(i==j) f[i][j]=tru原创 2017-10-27 12:13:31 · 193 阅读 · 0 评论 -
牛栏(Floyd)
//有点类似营救那道题,几乎是模板(要不是我写Floyd写的少,我才不写这题) #include #include #include #include using namespace std; const int maxn=310; int f[maxn][maxn],n,m,t; int main(){ int a,b,c; scanf("%d%d%d",&n,&m,&t原创 2017-10-27 08:48:32 · 267 阅读 · 0 评论 -
货车运输
#include #include #include #include using namespace std; typedef long long ll; const ll inf=100000000; const int maxn=5*1e4+10; ll n,m,qq[maxn],head[2*maxn],cnt,v[2*maxn],w[2*maxn],nxt[2*maxn原创 2017-11-01 16:21:45 · 234 阅读 · 0 评论
分享