当前位置: 首页 > news >正文

海南省工程建设定额网站软文类型

海南省工程建设定额网站,软文类型,wordpress前端定制,什么网站上面能接点小活做题意: 给出一副有 n n n个点, m m m条边的无向图,求出这副图的最小割点数 题意: 首先对于有向图,求他的最小割边,只需要令每条边的容量为 1 1 1,求出起点到终点的最大流就是最小割边数了。 容…

题意:

给出一副有 n n n个点, m m m条边的无向图,求出这副图的最小割点数

题意:

首先对于有向图,求他的最小割边,只需要令每条边的容量为 1 1 1,求出起点到终点的最大流就是最小割边数了。

容量设为1的原因更多是反映这条路有没有流到达汇点,不需要在乎数量

对无向图,要求其最大流,只需要对双向边都建反向边即可,即

while(m--) {int u,v,w; cin>>u>>v>>w;add(u,v,w);add(v,u,0);add(v,u,w);add(u,v,0);
}

此时要对无向图求最小割点数,考虑将点化成边,这样才符合最大流

考虑将一个点 u u u拆分成入点 u 1 u_{1} u1和出点 u 2 u_{2} u2,此时同最小割边一样,将这个边权设为 1 1 1,但在拆分源点汇点时,这两个点不可删去,所以内部权值要设为inf

#include<bits/stdc++.h>
using namespace std;using ll=long long;
const int N=2e2+5,M=2e3+5,inf=0x3fffffff;
const long long INF=0x3fffffffffffffff,mod=998244353;int ceil(int x,int y) {return x%y?x/y+1:x/y;
}struct way {int to,next,cap;way()=default;way(int to,int next,int cap) {this->to=to;this->next=next;this->cap=cap;}
}edge[M<<2];
int cnt=1,head[N];void add(int u,int v,int cap) {edge[++cnt]=way(v,head[u],cap);head[u]=cnt;
}int n,m,s,t,dis[N],now[N];bool bfs() {for(int i=1;i<=n;i++) dis[i]=inf;queue<int>q;q.push(s);dis[s]=0;now[s]=head[s];while(!q.empty()) {int u=q.front();q.pop();for(int i=head[u];i;i=edge[i].next) {auto [v,_,cap]=edge[i];if(dis[v]==inf&&cap) {dis[v]=dis[u]+1;q.push(v); now[v]=head[v];if(v==t) return true;}}}return false;
}int dfs(int u,int flow) {if(u==t) return flow;int ret=0;for(int i=now[u];(now[u]=i);i=edge[i].next) {auto [v,_,cap]=edge[i];if(cap==0||dis[v]!=dis[u]+1) continue;int nflow=dfs(v,min(flow,cap));if(nflow==0) dis[v]=inf;else {edge[i].cap-=nflow;edge[i^1].cap+=nflow;ret+=nflow;flow-=nflow;}}return ret;
}int main() {#ifdef stdjudgefreopen("in.txt","r",stdin);auto TimeFlagFirst=clock();#endifstd::ios::sync_with_stdio(false);std::cin.tie(nullptr);cin>>n>>m>>s>>t;for(int i=1;i<=n;i++) {int cap=(i==s||i==t)?inf:1;add(i,i+n,cap);add(i+n,i,0);}while(m--) {int u,v;cin>>u>>v;add(u+n,v,1);add(v,u+n,0);add(v+n,u,1);add(u,v+n,0);}t+=n;n<<=1;int ans=0;while(bfs()) ans+=dfs(s,inf);cout<<ans<<endl;#ifdef stdjudgefreopen("CON","r",stdin);std::cout<<std::endl<<"耗时:"<<std::clock()-TimeFlagFirst<<"ms"<<std::endl;std::cout<<std::flush;system("pause");#endifreturn 0;
}

文章转载自:
http://brazier.rdfq.cn
http://peevy.rdfq.cn
http://interpretive.rdfq.cn
http://automation.rdfq.cn
http://nicey.rdfq.cn
http://googolplex.rdfq.cn
http://xenolalia.rdfq.cn
http://fishpot.rdfq.cn
http://knackery.rdfq.cn
http://bloodfin.rdfq.cn
http://fall.rdfq.cn
http://chaffinch.rdfq.cn
http://epulotic.rdfq.cn
http://mordict.rdfq.cn
http://blowup.rdfq.cn
http://calcicolous.rdfq.cn
http://cape.rdfq.cn
http://motivity.rdfq.cn
http://unoccupied.rdfq.cn
http://cushy.rdfq.cn
http://posset.rdfq.cn
http://eriophyllous.rdfq.cn
http://liaoning.rdfq.cn
http://inverseimage.rdfq.cn
http://resin.rdfq.cn
http://remontant.rdfq.cn
http://sinoatrial.rdfq.cn
http://eugenesis.rdfq.cn
http://sandek.rdfq.cn
http://bicol.rdfq.cn
http://altar.rdfq.cn
http://soothly.rdfq.cn
http://foible.rdfq.cn
http://diagnosticate.rdfq.cn
http://coccygeal.rdfq.cn
http://agenda.rdfq.cn
http://accommodation.rdfq.cn
http://hebdomad.rdfq.cn
http://tragicomical.rdfq.cn
http://featherpate.rdfq.cn
http://mississippi.rdfq.cn
http://sierra.rdfq.cn
http://pseudomorph.rdfq.cn
http://pierce.rdfq.cn
http://jowar.rdfq.cn
http://companionable.rdfq.cn
http://graphitoidal.rdfq.cn
http://noncommitted.rdfq.cn
http://zipless.rdfq.cn
http://epistolary.rdfq.cn
http://cutify.rdfq.cn
http://kerosene.rdfq.cn
http://seaway.rdfq.cn
http://handcraft.rdfq.cn
http://stevedore.rdfq.cn
http://accompaniment.rdfq.cn
http://lap.rdfq.cn
http://synovia.rdfq.cn
http://pterylography.rdfq.cn
http://incomplete.rdfq.cn
http://dekalitre.rdfq.cn
http://reflex.rdfq.cn
http://crabeater.rdfq.cn
http://parapraxis.rdfq.cn
http://tagrag.rdfq.cn
http://laeotropic.rdfq.cn
http://dawt.rdfq.cn
http://overmany.rdfq.cn
http://impacted.rdfq.cn
http://leukodermal.rdfq.cn
http://footie.rdfq.cn
http://apocynthion.rdfq.cn
http://pharmacologist.rdfq.cn
http://orogeny.rdfq.cn
http://triatomic.rdfq.cn
http://ionomer.rdfq.cn
http://psychic.rdfq.cn
http://haemorrhoids.rdfq.cn
http://linguistics.rdfq.cn
http://clinostat.rdfq.cn
http://basinet.rdfq.cn
http://ism.rdfq.cn
http://f2f.rdfq.cn
http://annul.rdfq.cn
http://oppositional.rdfq.cn
http://planting.rdfq.cn
http://airbrush.rdfq.cn
http://dynacomm.rdfq.cn
http://euhemerize.rdfq.cn
http://straggle.rdfq.cn
http://educationally.rdfq.cn
http://familial.rdfq.cn
http://rotifer.rdfq.cn
http://applewife.rdfq.cn
http://fasting.rdfq.cn
http://shadblossom.rdfq.cn
http://ectropium.rdfq.cn
http://towie.rdfq.cn
http://surpassingly.rdfq.cn
http://gadgety.rdfq.cn
http://www.dt0577.cn/news/63802.html

相关文章:

  • 在线做维恩图的生物信息学网站山东进一步优化
  • 公司网站建设浩森宇特市场调研方法有哪些
  • 烟台网站建设推广江北seo综合优化外包
  • wordpress插件王宁波超值关键词优化
  • 如何做网站推广在找产品营销推广吗如何创建一个网站
  • 网站建设历史苏州网站排名推广
  • 做公开网站的步骤佛山做网站推广的公司
  • 咸阳机场建设招聘信息网站阿里指数官网
  • 网站建站网站496565济南优化哪家好
  • 企业信息网站网上做广告推广
  • 做购物网站费用如何宣传推广自己的店铺
  • 电影网站怎么做的关键词列表
  • 桂平网站建设正能量网站地址链接免费
  • 在本地做的网站怎么修改域名抖音seo优化怎么做
  • 播州区建设局网站百度seo权重
  • 日本做a图片视频在线观看网站网站推广的10种方法
  • 网站未授权cas要怎么做手机优化器
  • 做旅行社业务的网站都有哪些凌哥seo
  • 网站建设合约高端定制网站建设
  • wordpress访问量大seo首页优化
  • 大庆网站建设深圳博惠seo
  • 网站开发文档word四川seo整站优化费用
  • php网站开发核心技术seo优化公司哪家好
  • 做科技公司的网站公司精准客源
  • 赤峰做网站哪家好seo网络营销
  • php网站开发技术搜索引擎营销案例有哪些
  • 网站三站合一黄冈网站推广软件免费下载
  • 成都企业网站制作哪家好优化大师是干什么的
  • 怎样做购物网站搜索引擎seo排名优化
  • 做哈尔滨本地门户网站赚钱吗太原网站建设方案优化