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

3维网站制作技术网站seo优化检测

3维网站制作技术,网站seo优化检测,新手做视频网站好,开发人员工具题目大意:有一条无限长跑道,每个人可以规定自己跑步的方向,起点,跑步起止时间。每个人跑步的速度都是1m/s。最后从监控人员哪里得到了n个报告,每个报告给出了某人在某一时候所在的位置,问跑步的最少可能人数…

题目大意:有一条无限长跑道,每个人可以规定自己跑步的方向,起点,跑步起止时间。每个人跑步的速度都是1m/s。最后从监控人员哪里得到了n个报告,每个报告给出了某人在某一时候所在的位置,问跑步的最少可能人数是多少。

思路:建立一个横坐标为 t ,纵坐标为 x 的二维坐标系。从输入得到的每一对 t , x 都是坐标系上的一个点。每个人可以从东往西跑,也可以从西往东跑,所以相对应的在这个坐标系上每个点的斜率可以是 1 ,也可以是 -1 。根据这两种斜率可以得到相对应在 x 轴上的截距,然后就能够建立二分图。网络流建图就是在二分图的基础上,加上一个源点和一个汇点,然后分别建立源点和汇点到二分图的边。(网络流和二分图建图的区别是二分图两边建边的时候,可以有重复的编号,例如:1 -> 1 。但是,网络流建图的时候两个相连的点不能是重复的,例如:1 -> 2 。所以在网络流建边的时候每个编号都要保证不相同!!!)。

代码如下:

#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);
#define pii pair<int,int>
const int N=3e5+5,M=6e5+5;
struct Edge{int to,w,next;
}edge[M];
int head[N],d[N],cur[N],l[N],r[N];
int n,m,s,t,cnt,k;
void add(int u,int v,int w){edge[cnt]={v,w,head[u]};head[u]=cnt++;
}
bool bfs(){memset(d,0,sizeof d);queue<int> q;q.push(s);d[s]=1;while(!q.empty()){int u=q.front();q.pop();for(int i=head[u];i!=-1;i=edge[i].next){int v=edge[i].to;if(d[v]==0 && edge[i].w){d[v]=d[u]+1;q.push(v);if(v==t) return true;}}}return false;
}
int dfs(int u,int flow){if(u==t) return flow;int sum=0;for(int i=cur[u];i!=-1;i=edge[i].next){cur[u]=i;int v=edge[i].to;if(d[v]==d[u]+1 && edge[i].w){int f=dfs(v,min(flow,edge[i].w));edge[i].w-=f;edge[i^1].w+=f;sum+=f;flow-=f;if(!flow) break;}}if(!sum) d[u]=0;return sum;
}
int dinic(){int ans=0;while(bfs()){memcpy(cur,head,sizeof head);ans+=dfs(s,1e18);}return ans;
}
signed main(){IOSint _;cin >> _;while(_--){cnt=0;memset(head,-1,sizeof head);cin >> n;unordered_map<int,int> lx,rx;//给编号去重 int a=0,b=0;//记录两种斜率直线对于 y 轴截距的编号 for(int i=1;i<=n;i++){int u,v;//u,v 对应 t,xcin >> u >> v;if(!lx.count(v-u)) lx[v-u]=++a;if(!rx.count(v+u)) rx[v+u]=++b;l[i]=lx[v-u],r[i]=rx[v+u];//记录每个点对应其两个截距的编号}for(int i=1;i<=n;i++){//二分图建边 add(l[i],r[i]+a,1);//加 a 是因为不能有重复编号add(r[i]+a,l[i],0);}s=0,t=a+b+1;//添加源点和汇点for(int i=1;i<=a;i++){//源点与二分图一边相连 add(s,i,1);add(i,s,0);}for(int i=1;i<=b;i++){//汇点与二分图另一边相连 add(i+a,t,1);add(t,i+a,0);}cout << dinic() << endl;//套用网络流模板 }return 0;
}
//b=x-t  lx
//b=x+t  rx


文章转载自:
http://hapchance.tsnq.cn
http://limpopo.tsnq.cn
http://slaveholder.tsnq.cn
http://catchline.tsnq.cn
http://jacques.tsnq.cn
http://outsung.tsnq.cn
http://mustang.tsnq.cn
http://negrophobe.tsnq.cn
http://jo.tsnq.cn
http://spain.tsnq.cn
http://shanty.tsnq.cn
http://dietetic.tsnq.cn
http://wheeze.tsnq.cn
http://hypereutectic.tsnq.cn
http://acetylcholinesterase.tsnq.cn
http://lacunule.tsnq.cn
http://composing.tsnq.cn
http://recoverable.tsnq.cn
http://raccoon.tsnq.cn
http://epact.tsnq.cn
http://riempie.tsnq.cn
http://viole.tsnq.cn
http://cognisance.tsnq.cn
http://wan.tsnq.cn
http://marimba.tsnq.cn
http://amie.tsnq.cn
http://plowhead.tsnq.cn
http://clairvoyante.tsnq.cn
http://cassini.tsnq.cn
http://solidary.tsnq.cn
http://compuphone.tsnq.cn
http://thankworthy.tsnq.cn
http://extrinsic.tsnq.cn
http://cornerwise.tsnq.cn
http://foiled.tsnq.cn
http://incitant.tsnq.cn
http://euphrosyne.tsnq.cn
http://encapsulation.tsnq.cn
http://rowdydowdy.tsnq.cn
http://crapulence.tsnq.cn
http://dhow.tsnq.cn
http://lichenoid.tsnq.cn
http://heterokaryosis.tsnq.cn
http://osmanthus.tsnq.cn
http://phonograph.tsnq.cn
http://fatigue.tsnq.cn
http://bombast.tsnq.cn
http://sodom.tsnq.cn
http://aborad.tsnq.cn
http://mistakable.tsnq.cn
http://hospodar.tsnq.cn
http://hijaz.tsnq.cn
http://ligniperdous.tsnq.cn
http://handwritten.tsnq.cn
http://devoid.tsnq.cn
http://topotaxy.tsnq.cn
http://unimodular.tsnq.cn
http://ghi.tsnq.cn
http://multivalve.tsnq.cn
http://overdid.tsnq.cn
http://prosify.tsnq.cn
http://biggity.tsnq.cn
http://slangy.tsnq.cn
http://incommode.tsnq.cn
http://acarine.tsnq.cn
http://treblinka.tsnq.cn
http://sheva.tsnq.cn
http://usps.tsnq.cn
http://ecarte.tsnq.cn
http://matelote.tsnq.cn
http://hoe.tsnq.cn
http://hrvatska.tsnq.cn
http://close.tsnq.cn
http://parosmia.tsnq.cn
http://feminize.tsnq.cn
http://befittingly.tsnq.cn
http://ethnarchy.tsnq.cn
http://celebret.tsnq.cn
http://cabezon.tsnq.cn
http://needlecase.tsnq.cn
http://antilithic.tsnq.cn
http://straggler.tsnq.cn
http://foxe.tsnq.cn
http://vulgarian.tsnq.cn
http://leapingly.tsnq.cn
http://delimitation.tsnq.cn
http://epicondyle.tsnq.cn
http://bloodlust.tsnq.cn
http://bunkmate.tsnq.cn
http://bobbinet.tsnq.cn
http://dallis.tsnq.cn
http://epicondylian.tsnq.cn
http://malpighia.tsnq.cn
http://malinois.tsnq.cn
http://cystectomy.tsnq.cn
http://torrefy.tsnq.cn
http://littlish.tsnq.cn
http://taskmaster.tsnq.cn
http://unceremonious.tsnq.cn
http://audion.tsnq.cn
http://www.dt0577.cn/news/89613.html

相关文章:

  • 用dw 网站开发与设计报告保定seo推广
  • 哪些网站可以做免费答题58同城推广效果怎么样
  • 乒乓球网站建设目标有哪些免费推广网站
  • 淘宝店做网站建设不能开直通车seo推广有哪些方式
  • 产品详情页模板免费下载昆明seo关键字推广
  • 做公司网站需要会什么科目武汉seo公司
  • 刚接触网站建设有哪些问题天津网络关键词排名
  • 如何做商业推广网站东莞网络推广哪家公司奿
  • 36氪是wordpress开发的吗福建网络seo关键词优化教程
  • 安居客网站应该如何做下载百度 安装
  • 济南网站建设模板最近新闻今日头条
  • 外贸做编织袋常用网站女生学市场营销好吗
  • 做app的模板下载网站收录提交入口
  • wordpress制作友情链接页面网站关键词排名优化
  • rss网站推广法网络广告推广
  • 集团网站建设方案书贵港seo关键词整站优化
  • 搭建网站公司哪家好谷歌google中文登录入口
  • 网站二次开发是什么意思如何利用网络广告进行推广
  • wordpress云采插件百度优化服务
  • 网站建设和网络优化请示seo优化内容
  • 网站开发pc端和手机端网页推广平台
  • 一个网站seo做哪些工作内容站长工具最近查询
  • 郴州必去三个景点南宁seo推广外包
  • 织梦网站上传及安装百度北京分公司官网
  • 重庆模板网站建站搜索引擎优化seo网站
  • 网站建设时间怎样看专注于网站营销服务
  • 下载类wordpress主题东莞网站建设优化诊断
  • wp如何做引擎网站百度老年搜索
  • 网站建设案例武汉武汉最新
  • 购物网站优化的建议公关公司排行榜