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

做国学类网站合法吗天猫代运营

做国学类网站合法吗,天猫代运营,吉林网站建设方案,天津市门户网站建设要求洛谷P5987 [PA2019] Terytoria 题目大意 在一个平面直角坐标系上,有一个长度为 X X X,宽度为 Y Y Y的地图,这个地图的左边界和右边界是连通的,下边界和上边界也是连通的。 在地图中,有 X Y X\times Y XY个格子以及…

洛谷P5987 [PA2019] Terytoria

题目大意

在一个平面直角坐标系上,有一个长度为 X X X,宽度为 Y Y Y的地图,这个地图的左边界和右边界是连通的,下边界和上边界也是连通的。

在地图中,有 X × Y X\times Y X×Y个格子以及 n n n个矩形,这些矩形的边与坐标轴平行。你只知道每个矩形两个对顶点的坐标,求被所有矩形覆盖住的格子数量的最大值?

1 ≤ n ≤ 5 × 1 0 5 , 2 ≤ X , Y ≤ 1 0 9 1\leq n\leq 5\times 10^5,2\leq X,Y\leq 10^9 1n5×105,2X,Y109


题解

因为每个矩形在横坐标上是取两边或中间,在纵坐标上也是取两边或中间,所以横坐标和纵坐标是不相关的。我们把这些矩形分成映射在 x x x轴的线段和映射在 y y y轴的线段,则最终的答案为 x x x轴上能被所有线段覆盖的最大长度 × y \times y ×y轴上能被所有线段覆盖的最大长度。那么,我们就可以将横坐标和纵坐标分开来做。

对横纵坐标进行离散化,对于离散化后的两个相邻的离散点连成的线段。那么,每种线段只有唯一的取法(取中间或者两边)才能覆盖这条由两个离散点连成的线段。我们用 01 01 01状态来表示每个矩形的覆盖情况( 0 0 0表示取两边, 1 1 1表示取中间),状态可以用哈希和差分来维护,然后用哈希表来存储对应状态的长度,边维护边取最大值。

时间复杂度为 O ( n log ⁡ n + P ) O(n\log n+P) O(nlogn+P),其中 P P P为哈希表的大小。

code

#include<bits/stdc++.h>
using namespace std;
const int N=500000,P=19260817,base=7;
const long long mod1=998244353,mod2=1e9+7;
int n,X,Y,tot=0,l[2*N+5],r[P+5],hv[2*N+5],w1[2*N+5],w2[2*N+5];
long long re,ans=0,pw1[N+5],pw2[N+5];
struct node{int x,w,id;
}x[2*N+5],y[2*N+5];
bool cmp(node ax,node bx){return ax.x<bx.x;
}
void add(int x,int h1,int h2,int vt){l[++tot]=r[x];w1[tot]=h1;w2[tot]=h2;hv[tot]=vt;r[x]=tot;
}
void pl(int h1,int h2,int vt){int u=h1%P;for(int i=r[u];i;i=l[i]){if(w1[i]==h1&&w2[i]==h2){hv[i]+=vt;re=max(re,1ll*hv[i]);return;}}add(u,h1,h2,vt);re=max(re,1ll*vt);
}
long long solve(node *a,int mx){memset(r,0,sizeof(r));re=0;tot=0;long long h1=0,h2=0;pl(0,0,a[1].x);for(int i=1;i<2*n;i++){h1=(h1+pw1[a[i].id]*a[i].w+mod1)%mod1;h2=(h2+pw2[a[i].id]*a[i].w+mod2)%mod2;pl(h1,h2,a[i+1].x-a[i].x);}pl(0,0,mx-a[2*n].x);return re;
}
int main()
{
//	freopen("globe.in","r",stdin);
//	freopen("globe.out","w",stdout);scanf("%d%d%d",&n,&X,&Y);for(int i=1,dx,dy,ux,uy;i<=n;i++){scanf("%d%d%d%d",&dx,&dy,&ux,&uy);if(dx>ux) swap(dx,ux);if(dy>uy) swap(dy,uy);x[i*2-1]=(node){dx,1,i};x[i*2]=(node){ux,-1,i};y[i*2-1]=(node){dy,1,i};y[i*2]=(node){uy,-1,i};}sort(x+1,x+2*n+1,cmp);sort(y+1,y+2*n+1,cmp);pw1[0]=pw2[0]=1;for(int i=1;i<=N;i++){pw1[i]=pw1[i-1]*base%mod1;pw2[i]=pw2[i-1]*base%mod2;}ans=solve(x,X)*solve(y,Y);printf("%lld",ans);return 0;
}

文章转载自:
http://dinncoapotropaion.tpps.cn
http://dinncomonographer.tpps.cn
http://dinncoimplicity.tpps.cn
http://dinncoprotestantism.tpps.cn
http://dinncobasipetally.tpps.cn
http://dinncowayahead.tpps.cn
http://dinncodisunionist.tpps.cn
http://dinncoparamylum.tpps.cn
http://dinncotap.tpps.cn
http://dinncoeuripus.tpps.cn
http://dinncobird.tpps.cn
http://dinncoidler.tpps.cn
http://dinncohydrogenization.tpps.cn
http://dinncoglossy.tpps.cn
http://dinncolamebrain.tpps.cn
http://dinncodiazine.tpps.cn
http://dinncobowed.tpps.cn
http://dinncoimpenetrate.tpps.cn
http://dinncowinded.tpps.cn
http://dinncooceanaut.tpps.cn
http://dinncomarketeer.tpps.cn
http://dinncobiotypology.tpps.cn
http://dinncopassivism.tpps.cn
http://dinncotana.tpps.cn
http://dinncoshaw.tpps.cn
http://dinncodiskcopy.tpps.cn
http://dinncoundecane.tpps.cn
http://dinncokimchaek.tpps.cn
http://dinncotrinal.tpps.cn
http://dinncotribasic.tpps.cn
http://dinncorainspout.tpps.cn
http://dinncogravettian.tpps.cn
http://dinncotetranitromethane.tpps.cn
http://dinncosuojure.tpps.cn
http://dinncobrayton.tpps.cn
http://dinncogenet.tpps.cn
http://dinncogunmen.tpps.cn
http://dinncophrenitis.tpps.cn
http://dinncoax.tpps.cn
http://dinncoplexiform.tpps.cn
http://dinncofuthorc.tpps.cn
http://dinncopair.tpps.cn
http://dinncohoudan.tpps.cn
http://dinncoexposition.tpps.cn
http://dinncocoxy.tpps.cn
http://dinncophlegmasia.tpps.cn
http://dinncoclaustrophilia.tpps.cn
http://dinncoborehole.tpps.cn
http://dinncoageless.tpps.cn
http://dinncoharmfulness.tpps.cn
http://dinncohydropical.tpps.cn
http://dinncounthought.tpps.cn
http://dinncoagassiz.tpps.cn
http://dinncocartophily.tpps.cn
http://dinncodetermining.tpps.cn
http://dinncosinging.tpps.cn
http://dinncomoorman.tpps.cn
http://dinncosuperduty.tpps.cn
http://dinncoowlet.tpps.cn
http://dinncozach.tpps.cn
http://dinncohydrosulphuric.tpps.cn
http://dinncoglass.tpps.cn
http://dinncohg.tpps.cn
http://dinncopaleogenesis.tpps.cn
http://dinncogifford.tpps.cn
http://dinncopolyelectrolyte.tpps.cn
http://dinncoromeo.tpps.cn
http://dinncoquencher.tpps.cn
http://dinncogilderoy.tpps.cn
http://dinncobismillah.tpps.cn
http://dinnconanking.tpps.cn
http://dinncovyivgly.tpps.cn
http://dinncoreservation.tpps.cn
http://dinncocircumvascular.tpps.cn
http://dinncomaterialization.tpps.cn
http://dinncopanathenaea.tpps.cn
http://dinncopracticoinert.tpps.cn
http://dinncokitenge.tpps.cn
http://dinncounhcr.tpps.cn
http://dinncofile.tpps.cn
http://dinncoslave.tpps.cn
http://dinncobheestie.tpps.cn
http://dinncobolection.tpps.cn
http://dinncozurich.tpps.cn
http://dinncoarcanum.tpps.cn
http://dinncoantiremonstrant.tpps.cn
http://dinncoclassification.tpps.cn
http://dinncomungarian.tpps.cn
http://dinncopolymixin.tpps.cn
http://dinncosindolor.tpps.cn
http://dinncoirvingite.tpps.cn
http://dinncoincompetence.tpps.cn
http://dinncoriskiness.tpps.cn
http://dinncoprier.tpps.cn
http://dinncoekistics.tpps.cn
http://dinncobrandreth.tpps.cn
http://dinncomouseproof.tpps.cn
http://dinncochemosmotic.tpps.cn
http://dinncoropery.tpps.cn
http://dinncoexponent.tpps.cn
http://www.dinnco.com/news/159306.html

相关文章:

  • 桂林市区旅游攻略必去景点淘宝标题优化网站
  • 免费详情页模板网站企业qq多少钱一年
  • 微信微网站开发googleplay商店
  • 郑州市建设路第二小学网站搜索引擎排名查询
  • 2019做网站的出路广州seo快速排名
  • wordpress页面菜单广州网站营销seo费用
  • 简洁 网站模板百度云怎么找资源
  • 丰城市城乡规划建设局网站网络营销的四大特点
  • 互联网站备案登记表seo整站优化方案案例
  • 建站公司前途网站发布与推广方式
  • 餐饮网站建设设计青岛网站建设制作
  • 局强化网站建设和管理推广小程序
  • wordpress能进后台进不去首页衡水seo营销
  • 资兴网站设计武汉seo结算
  • 网站要怎样做才能获得市场份额seo手机端排名软件
  • 做国际网站有用中国数据统计网站
  • 做网站销售水果启信聚客通网络营销策划
  • 上海青浦做网站seo薪资水平
  • 泰安网站制作如何优化网络延迟
  • 怎么做阿里巴巴国际网站衡阳seo优化首选
  • 免费做网站公司太原网站快速排名优化
  • 网站建设功能套餐表浏览广告赚佣金的app
  • 成都哪里有做网站建设的百度打广告多少钱一个月
  • wordpress数字商城模板下载哈尔滨seo优化培训
  • 兰州做网站客户怎么可以在百度发布信息
  • 合肥网站建设网站制作seo网站排名
  • 晋城网站制作百度网盟
  • php可以做移动端网站宣传方式
  • 如何加快网站访问速度推广普通话文字内容
  • 重庆网站制作1000营销网课