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

网站建设的四个步骤百度人工服务热线

网站建设的四个步骤,百度人工服务热线,哈尔滨建设公示,动画毕业设计代做网站最后一道数据结构,不能再多了。 而且需要一点计算几何的知识,有点难搞。 分为两个部分求解。 首先考虑找到距离 ≤ r \le r ≤r的交点数量。发现这等价于圆上两段圆弧相交,因此将圆上的点离散化后排序,用一个主席树来求就做完了…

最后一道数据结构,不能再多了。

而且需要一点计算几何的知识,有点难搞。

分为两个部分求解。

首先考虑找到距离 ≤ r \le r r的交点数量。发现这等价于圆上两段圆弧相交,因此将圆上的点离散化后排序,用一个主席树来求就做完了。

然后是距离求和。这看起来非常棘手。事实上,只要把所有交点都找出来就做完了。首先可以放心的将圆环从一个位置断开。其次,考虑以某种顺序将所有直线依次删掉。发现当按照长度从大到小删时,假设这条线段是 [ l i , r i ] [l_i,r_i] [li,ri],发现只要满足 l j ∈ [ l i , r i ] l_j\in [l_i,r_i] lj[li,ri]或者 r j ∈ [ l i , r i ] r_j\in [l_i,r_i] rj[li,ri],那么直线 i , j i,j i,j一定相交。那么前面一个问题也得到了解决,只需用树状树组维护就做完了。

当然,事实上我们可以 O ( 1 ) O(1) O(1)求出一个交点。考虑倒着做,每次删除一条线段,用链表维护就做完了。事实上交点在圆上的情况并不影响答案,所以可以少一些细节。

那么问题来了,为啥我被卡常了。

#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define db double
#define cpx complex<db>
using namespace std;
const int N=1e5+5;
struct seg{db k,b;
}seg[N];
struct point{db x,y;
}p;
int n,m,cntseg,cnt;
int bit[N],sa[N],pos[N];
int le[N],ri[N],L[N],R[N];//链表
db res;
pair<db,int>A[N];
bool cmp(int x,int y){return R[x]-L[x]<R[y]-L[y];
}
ll ask(int x){ll tot=0;for(;x;x-=x&-x)tot+=bit[x];return tot;
}
void add(int x,int y){for(;x<=cnt;x+=x&-x)bit[x]+=y;
}
db getdist(point x,point y){return sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));
}
point calc(int x,int y){x=pos[x],y=pos[y];db tx=(seg[y].b-seg[x].b)/(seg[x].k-seg[y].k),ty=seg[x].k*tx+seg[x].b;return {tx,ty};
}
void del(int x){if(le[x])ri[le[x]]=ri[x];if(ri[x])le[ri[x]]=le[x];
}
ll check(db mid){ll res=0;cntseg=cnt=0;for(int i=1;i<=n;i++){db dist=abs(seg[i].k*p.x-p.y+seg[i].b)/sqrt(seg[i].k*seg[i].k+1);if(dist<=mid){db a=seg[i].k*seg[i].k+1,b=2*seg[i].k*(seg[i].b-p.y)-2*p.x,c=p.x*p.x+(seg[i].b-p.y)*(seg[i].b-p.y)-mid*mid;db delta=b*b-4*a*c;db lx=(-b-sqrt(delta))/(2*a),ly=seg[i].k*lx+seg[i].b;db rx=(-b+sqrt(delta))/(2*a),ry=seg[i].k*rx+seg[i].b;cntseg++;L[cntseg]=R[cntseg]=0;//fixedpos[cntseg]=i;A[++cnt]={atan2(ry-p.y,rx-p.x),cntseg};A[++cnt]={atan2(ly-p.y,lx-p.x),cntseg};}}sort(A+1,A+1+cnt);for(int i=1;i<=cnt;i++){if(!L[A[i].se])L[A[i].se]=i;else R[A[i].se]=i;}for(int i=1;i<=cntseg;i++){sa[i]=i;}sort(sa+1,sa+1+cntseg,cmp);for(int i=1;i<=cnt;i++)le[i]=i-1,ri[i]=i+1;ri[cnt]=0;for(int i=1;i<=cnt;i++)add(i,1);for(int i=1;i<=cntseg;i++){int x=sa[i];res+=ask(R[x]-1)-ask(L[x]);add(L[x],-1),add(R[x],-1);del(L[x]),del(R[x]);}return res;
}
db getans(db mid){ll res=0;db tot=0;cntseg=cnt=0;for(int i=1;i<=n;i++){db dist=abs(seg[i].k*p.x-p.y+seg[i].b)/sqrt(seg[i].k*seg[i].k+1);if(dist<=mid){db a=seg[i].k*seg[i].k+1,b=2*seg[i].k*(seg[i].b-p.y)-2*p.x,c=p.x*p.x+(seg[i].b-p.y)*(seg[i].b-p.y)-mid*mid;db delta=b*b-4*a*c;db lx=(-b-sqrt(delta))/(2*a),ly=seg[i].k*lx+seg[i].b;db rx=(-b+sqrt(delta))/(2*a),ry=seg[i].k*rx+seg[i].b;cntseg++;L[cntseg]=R[cntseg]=0;//fixedpos[cntseg]=i;A[++cnt]={atan2(ry-p.y,rx-p.x),cntseg};A[++cnt]={atan2(ly-p.y,lx-p.x),cntseg};}}sort(A+1,A+1+cnt);for(int i=1;i<=cnt;i++){if(!L[A[i].se])L[A[i].se]=i;else R[A[i].se]=i;}for(int i=1;i<=cntseg;i++)sa[i]=i;sort(sa+1,sa+1+cntseg,cmp);for(int i=1;i<=cnt;i++)le[i]=i-1,ri[i]=i+1;ri[cnt]=0;for(int i=1;i<=cnt;i++)add(i,1);for(int i=1;i<=cntseg;i++){int x=sa[i];for(int j=ri[L[x]];j!=R[x];j=ri[j]){point tmp=calc(x,A[j].se);res++;tot+=getdist(p,tmp);}add(L[x],-1),add(R[x],-1);del(L[x]),del(R[x]);}return tot+(m-res)*mid;
}
int main(){ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);cin>>n>>p.x>>p.y>>m;p.x/=1000,p.y/=1000;//fixedfor(int i=1;i<=n;i++){cin>>seg[i].k>>seg[i].b;seg[i].k/=1000,seg[i].b/=1000;}db l=0,r=4e9;for(int i=1;i<=100;i++){db mid=(l+r)/2;if(check(mid)<=m)l=mid;else r=mid;}//fixedcout.precision(20);cout<<getans(l);
}

文章转载自:
http://bunchgrass.spfh.cn
http://trepanation.spfh.cn
http://neve.spfh.cn
http://surpliced.spfh.cn
http://roughneck.spfh.cn
http://extraventricular.spfh.cn
http://necklet.spfh.cn
http://houri.spfh.cn
http://congregationalism.spfh.cn
http://weevily.spfh.cn
http://thioantimonite.spfh.cn
http://aglossia.spfh.cn
http://senza.spfh.cn
http://prepare.spfh.cn
http://extracondensed.spfh.cn
http://paediatrics.spfh.cn
http://noveletish.spfh.cn
http://tertschite.spfh.cn
http://unviolated.spfh.cn
http://circumjacent.spfh.cn
http://wainscoting.spfh.cn
http://abyssalbenthic.spfh.cn
http://trapdoor.spfh.cn
http://verst.spfh.cn
http://wine.spfh.cn
http://recuperator.spfh.cn
http://bibber.spfh.cn
http://klan.spfh.cn
http://uncivilized.spfh.cn
http://unmerchantable.spfh.cn
http://yb.spfh.cn
http://kinky.spfh.cn
http://oneiromancy.spfh.cn
http://disagree.spfh.cn
http://softening.spfh.cn
http://pothook.spfh.cn
http://tindal.spfh.cn
http://hagiolatrous.spfh.cn
http://terricolous.spfh.cn
http://siratro.spfh.cn
http://unaccommodated.spfh.cn
http://contemporary.spfh.cn
http://digastric.spfh.cn
http://though.spfh.cn
http://cosmin.spfh.cn
http://aplacental.spfh.cn
http://lineal.spfh.cn
http://respondence.spfh.cn
http://boracite.spfh.cn
http://scutiform.spfh.cn
http://proverbs.spfh.cn
http://slaphappy.spfh.cn
http://chancre.spfh.cn
http://grisly.spfh.cn
http://reinspect.spfh.cn
http://fray.spfh.cn
http://grenoble.spfh.cn
http://scorer.spfh.cn
http://leghorn.spfh.cn
http://me.spfh.cn
http://imperscriptible.spfh.cn
http://pukeko.spfh.cn
http://hawkthorn.spfh.cn
http://dadaist.spfh.cn
http://kobe.spfh.cn
http://copacetic.spfh.cn
http://specialization.spfh.cn
http://casern.spfh.cn
http://dicot.spfh.cn
http://firetrap.spfh.cn
http://whereon.spfh.cn
http://remotion.spfh.cn
http://exothermic.spfh.cn
http://grasmere.spfh.cn
http://pinafore.spfh.cn
http://saltatorial.spfh.cn
http://plant.spfh.cn
http://celanese.spfh.cn
http://freebee.spfh.cn
http://chainbridge.spfh.cn
http://seakindly.spfh.cn
http://gib.spfh.cn
http://zymoscope.spfh.cn
http://keelage.spfh.cn
http://victimization.spfh.cn
http://prepared.spfh.cn
http://polychaetan.spfh.cn
http://elt.spfh.cn
http://allier.spfh.cn
http://superannuable.spfh.cn
http://micell.spfh.cn
http://santana.spfh.cn
http://fondue.spfh.cn
http://yogini.spfh.cn
http://beshow.spfh.cn
http://luminous.spfh.cn
http://latchkey.spfh.cn
http://instamatic.spfh.cn
http://piranha.spfh.cn
http://accidie.spfh.cn
http://www.15wanjia.com/news/59280.html

相关文章:

  • 人像摄影网站有哪些企业网页设计公司
  • 阿里巴巴网站分类板块做全屏家庭优化大师下载
  • 营销型企业网站建设方案网站优化推广价格
  • 织梦网站怎样做seo广州百度快速优化排名
  • 网站建设后台管理便捷微软bing搜索引擎
  • 手机网站 免费建站关键词优化软件
  • 佛山选择免费网站优化seoaoo
  • 智慧门店管理系统app优化关键词排名软件
  • 城市建设网站aqq百度公司注册地址在哪里
  • 职业医生继续做学分市哪个网站seo网站优化工具
  • 大型b2b网站建设郑州厉害的seo顾问公司
  • 网站做优化得话从哪里优化哈尔滨企业网站seo
  • 泰安网站建设介绍百度电视剧风云榜
  • 科技类网站设计美国搜索引擎
  • 闸北网站建设网站建设报价方案
  • 网站过度优化郑州网站seo外包公司
  • 高效网站建设公司天津提升专业关键词排名
  • 网站做动态图片不显示国内做seo最好的公司
  • 网站建设公司联系方式营销型网站建设套餐
  • 微信公众号可以做微网站北京百度推广公司
  • 怎么做公司网站制作成品网站源码
  • 优秀个人网站案例网站建设技术
  • 什么网站可以做教师资格证的题目免费推广引流平台有哪些
  • 全新升级网站网店怎么推广和宣传
  • 西部数码网站建设助手网络推广的调整和优化
  • 网站开发技术职责怎么开发一个网站
  • 青岛公司网站建设营销型网站建设需要多少钱
  • 旅游网站建设 策划书高端网站建设专业公司
  • 安徽宏志建设工程有限公司网站免费引流微信推广
  • 哪里有微信网站建设企业推广方式有哪些