当前位置: 首页> 房产> 政策 > 怎样浏览被国内封禁的网站_中山网站制作公司_推广平台有哪些?_东莞网站建设做网站

怎样浏览被国内封禁的网站_中山网站制作公司_推广平台有哪些?_东莞网站建设做网站

时间:2025/7/11 1:14:37来源:https://blog.csdn.net/2301_81488029/article/details/142407446 浏览次数:0次
怎样浏览被国内封禁的网站_中山网站制作公司_推广平台有哪些?_东莞网站建设做网站

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N=5e3+5;
const int M=5e4+5;
struct Edge{int to,w,next,cost;
}edge[M*2];
int head[N],dis[N],pre[N],money[N],vis[N];
int n,m,s,t,cnt,min_cost,max_flow;
void add(int u,int v,int w,int cost){edge[cnt]={v,w,head[u],cost};head[u]=cnt++;
}
bool spfa(){//找最短路的增广流 memset(dis,0,sizeof dis);memset(money,0x3f,sizeof money);queue<int> q;q.push(s);dis[s]=1e18;money[s]=0;vis[s]=1;while(!q.empty()){int u=q.front();q.pop();vis[u]=0;for(int i=head[u];i!=-1;i=edge[i].next){int v=edge[i].to;if(money[v]>money[u]+edge[i].cost && edge[i].w){money[v]=money[u]+edge[i].cost;//最短路 dis[v]=min(dis[u],edge[i].w);//这条最短路的最大流量 pre[v]=i;//前驱边 if(!vis[v]) q.push(v),vis[v]=1;}}}return dis[t]>0;
}
void EK(){while(spfa()){for(int v=t;v!=s;){int i=pre[v];edge[i].w-=dis[t];edge[i^1].w+=dis[t];v=edge[i^1].to;}//更新残留网 max_flow+=dis[t];//累加可行流 min_cost+=dis[t]*money[t];//累加费用 }
}
signed main(){IOScin >> n >> m >> s >> t;memset(head,-1,sizeof head);for(int i=1;i<=m;i++){int u,v,w,cost;cin >> u >> v >> w >> cost;add(u,v,w,cost);add(v,u,0,-cost);}EK();cout << max_flow << " " << min_cost << endl;return 0;
}

关键字:怎样浏览被国内封禁的网站_中山网站制作公司_推广平台有哪些?_东莞网站建设做网站

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: