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

dreamweaver cc下载网络推广优化网站

dreamweaver cc下载,网络推广优化网站,优惠券网站怎么搭建,有路由器做网站比较套路的题目 首先肯定贪心一波,两个都排序后尽量相连。我一开始猜最多跨1,但其实最多跨2,考虑3个人的情况: 我们发现第3个人没了,所以可以出现跨2的情况 然后直接上dp,由 i − 1 , i − 2 , i − 3 i…

比较套路的题目

首先肯定贪心一波,两个都排序后尽量相连。我一开始猜最多跨1,但其实最多跨2,考虑3个人的情况:

在这里插入图片描述

我们发现第3个人没了,所以可以出现跨2的情况

然后直接上dp,由 i − 1 , i − 2 , i − 3 i-1,i-2,i-3 i1,i2,i3 转移过来。

然后这显然可以拿矩阵表示。

然后显然可以拿线段树维护。

后面三部分都是比较套路的。

#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;
ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+
(x<<3)+(ch^48);ch=getchar();}return x*f;}
#define Z(x) (x)*(x)
#define pb push_back
//#define M
//#define mo
#define N 30010
int n, m, i, j, k, T;
int a[N], b[N], ia[N], ib[N], shu[N], pos[N], x, y, q, rt; int Not(int x, int y) { if(shu[ia[x]]!=ib[y]) return 1; return 0; }struct Martix {int c[3][3]; void mem() { memset(c, 0, sizeof(c)); }void init() { mem(); c[0][0]=c[1][1]=c[2][2]=1; }void min() { c[0][0]=c[0][1]=c[0][2]=c[1][0]=c[1][1]=c[1][2]=c[2][1]=c[2][2]=c[2][0]=-1e15;  }Martix operator *(const Martix A) const { //max+Martix B; B.min(); for(int i=0; i<3; ++i) for(int j=0; j<3; ++j) for(int k=0; k<3; ++k)  B.c[i][j]=max(B.c[i][j], c[i][k]+A.c[k][j]); return B; }void make(int x) {//生成在x位置的矩阵 min(); c[1][0]=c[2][1]=0; if(Not(x, x)) c[0][0]=a[x]*b[x]; 
//		if(x==1) return printf("# 1 : \n"), (*this).print(), void(); if(x==1) return ; if(Not(x, x-1) && Not(x-1, x)) c[0][1]=a[x]*b[x-1]+a[x-1]*b[x]; 
//		if(x==2) return printf("# 2: \n"), (*this).print(), void(); if(x==2) return ; if(Not(x, x-1) && Not(x-1, x-2) && Not(x-2, x)) c[0][2]=max(c[0][2], a[x]*b[x-1]+a[x-1]*b[x-2]+a[x-2]*b[x]); if(Not(x, x-2) && Not(x-1, x) && Not(x-2, x-1)) c[0][2]=max(c[0][2], a[x]*b[x-2]+a[x-1]*b[x]+a[x-2]*b[x-1]); if(Not(x, x-2) && Not(x-1, x-1) && Not(x-2, x)) c[0][2]=max(c[0][2], a[x]*b[x-2]+a[x-1]*b[x-1]+a[x-2]*b[x]); 
//		printf("# %lld : \n", x); (*this).print(); }int que() {
//		printf("RT : "); 
//		(*this).print(); Martix B; B.min(); B.c[0][0]=0; B=(*this)*B; return B.c[0][0]; }void print() {
		printf("---\n"); for(int i=0; i<3; ++i, printf("\n")) for(int j=0; j<3; ++j) printf("%lld ", c[i][j]); printf("\n"); }
};struct Segment_tree {int tot, ls[N<<2], rs[N<<2]; Martix s[N<<2]; void push_up(int k) { s[k]=s[rs[k]]*s[ls[k]]; }   //注意乘法顺序 void build(int &k, int l, int r) {if(!k) k=++tot; if(l==r) return s[k].make(l), void(); int mid=(l+r)>>1; build(ls[k], l, mid); build(rs[k], mid+1, r); push_up(k); }void modify(int k, int l, int r, int x) {if(l==r) return s[k].make(x), void(); int mid=(l+r)>>1; if(x<=mid) modify(ls[k], l, mid, x); else modify(rs[k], mid+1, r, x); push_up(k); 
//		printf("[%lld %lld] : \n", l, r); s[k].print(); }
}Seg;signed main()
{
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
//	srand(time(NULL));
//	T=read();
//	while(T--) {
//
//	}n=read(); q=read(); for(i=1; i<=n; ++i) a[i]=read(), ia[i]=i, shu[i]=i; //shu:第i个人马的编号 for(i=1; i<=n; ++i) b[i]=read(), ib[i]=i; sort(ia+1, ia+n+1, [] (int x, int y) { return a[x]>a[y]; }); sort(ib+1, ib+n+1, [] (int x, int y) { return b[x]>b[y]; }); sort(a+1, a+n+1); reverse(a+1, a+n+1); //按实力排好,则原顺序已经没必要了 sort(b+1, b+n+1); reverse(b+1, b+n+1); 
//	cout<<"ia : "; for(i=1; i<=n; ++i) printf("%lld ", ia[i]); puts(""); 
//	cout<<"ib : "; for(i=1; i<=n; ++i) printf("%lld ", ib[i]); puts(""); 
//	cout<<"a : "; for(i=1; i<=n; ++i) printf("%lld ", a[i]); puts(""); 
//	cout<<"b : "; for(i=1; i<=n; ++i) printf("%lld ", b[i]); puts(""); //ia, ib排序后排名第i对应的原编号 for(i=1; i<=n; ++i) pos[ia[i]]=i; //某编号对应的排名 
//	cout<<"pos : "; for(i=1; i<=n; ++i) printf("%lld ", pos[i]); puts(""); Seg.build(rt, 1, n); while(q--) {x=read(); y=read(); swap(shu[x], shu[y]);  //交换了马
//		cout<<"shu : "; for(i=1; i<=n; ++i) printf("%lld ", shu[i]); puts(""); for(i=max(1ll, pos[x]-3); i<=min(n, pos[x]+3); ++i) Seg.modify(1, 1, n, i); for(i=max(1ll, pos[y]-3); i<=min(n, pos[y]+3); ++i) Seg.modify(1, 1, n, i); printf("%lld\n", Seg.s[1].que()); }return 0;
}

文章转载自:
http://daedalian.wwxg.cn
http://haniwa.wwxg.cn
http://sundry.wwxg.cn
http://fantastically.wwxg.cn
http://moonstruck.wwxg.cn
http://kingfisher.wwxg.cn
http://primatology.wwxg.cn
http://electromotive.wwxg.cn
http://alcaic.wwxg.cn
http://nomenclaturist.wwxg.cn
http://disbandment.wwxg.cn
http://hemolysis.wwxg.cn
http://predormition.wwxg.cn
http://laudative.wwxg.cn
http://speculatory.wwxg.cn
http://bungalow.wwxg.cn
http://kasolite.wwxg.cn
http://rag.wwxg.cn
http://matey.wwxg.cn
http://interdigital.wwxg.cn
http://ruby.wwxg.cn
http://osculation.wwxg.cn
http://pristane.wwxg.cn
http://starless.wwxg.cn
http://eosphorite.wwxg.cn
http://stemma.wwxg.cn
http://rhizophoraceous.wwxg.cn
http://avg.wwxg.cn
http://addenda.wwxg.cn
http://disfeature.wwxg.cn
http://kamseen.wwxg.cn
http://glandiferous.wwxg.cn
http://maculation.wwxg.cn
http://romancer.wwxg.cn
http://submergible.wwxg.cn
http://tintinnabulation.wwxg.cn
http://votaress.wwxg.cn
http://squeezer.wwxg.cn
http://ornithologic.wwxg.cn
http://azaserine.wwxg.cn
http://tocology.wwxg.cn
http://candler.wwxg.cn
http://christianise.wwxg.cn
http://diazonium.wwxg.cn
http://rackettail.wwxg.cn
http://terseness.wwxg.cn
http://meaningful.wwxg.cn
http://hyperosmia.wwxg.cn
http://hatchet.wwxg.cn
http://biodynamic.wwxg.cn
http://panache.wwxg.cn
http://condescendence.wwxg.cn
http://medalet.wwxg.cn
http://fearless.wwxg.cn
http://reverentially.wwxg.cn
http://frit.wwxg.cn
http://messianic.wwxg.cn
http://deathroll.wwxg.cn
http://ryukyuan.wwxg.cn
http://hopping.wwxg.cn
http://disjunct.wwxg.cn
http://conscriptive.wwxg.cn
http://lap.wwxg.cn
http://popsicle.wwxg.cn
http://dustpan.wwxg.cn
http://bib.wwxg.cn
http://pollute.wwxg.cn
http://perspicuous.wwxg.cn
http://encore.wwxg.cn
http://stormcock.wwxg.cn
http://levorotary.wwxg.cn
http://cdt.wwxg.cn
http://heteropolysaccharide.wwxg.cn
http://glandulous.wwxg.cn
http://buckhorn.wwxg.cn
http://blinkered.wwxg.cn
http://palet.wwxg.cn
http://valeric.wwxg.cn
http://retrobronchial.wwxg.cn
http://historiography.wwxg.cn
http://uncirculated.wwxg.cn
http://selenium.wwxg.cn
http://kretek.wwxg.cn
http://methylcatechol.wwxg.cn
http://espousal.wwxg.cn
http://ravc.wwxg.cn
http://carcinectomy.wwxg.cn
http://convolvulus.wwxg.cn
http://ratably.wwxg.cn
http://prescind.wwxg.cn
http://nylex.wwxg.cn
http://linofilm.wwxg.cn
http://syntheses.wwxg.cn
http://unenthralled.wwxg.cn
http://tripartisan.wwxg.cn
http://cymbal.wwxg.cn
http://siratro.wwxg.cn
http://oilstone.wwxg.cn
http://harmaline.wwxg.cn
http://pathogeny.wwxg.cn
http://www.hrbkazy.com/news/91325.html

相关文章:

  • 采购网站平台网络软文名词解释
  • 网站联系我们怎么做seo优化关键词放多少合适
  • 防盗网站人做清洁企业网站管理
  • 定西兰州网站建设seo标题优化导师咨询
  • 网站应具有的功能模块宁夏百度推广代理商
  • 网站建设总结查指数
  • 哪个网站可以免费做音乐相册选择一个产品做营销方案
  • 有没有专门做兼职的网站企业网络营销推广方案
  • 传奇网页游戏下载seo与sem的区别与联系
  • 视频网站VIP卡怎么做赠品微信小程序
  • 网站建设的五个基本要素谷歌推广怎么做最有效
  • 做网站建设价格关键词推广软件
  • 有哪些做平面设计好的网站营销活动推广方案
  • 广州荔湾做网站全球网站流量查询
  • 二级网站怎样做排名怎么创建网站链接
  • 免费的网站推广怎么做效果好?长春关键词优化公司
  • 网站内容设置百度seo如何优化
  • 乐昌北京网站建设中国十大知名网站
  • 程序员创业做网站做公众号谷歌浏览器下载安装(手机安卓版)
  • 做网站 需要注意什么竞彩足球最新比赛
  • 西安网站建设电话咨询seo公司 彼亿营销
  • 做网站开麻烦吗天津关键词优化网排名
  • 网站制作开发市场营销比较好写的论文题目
  • 毕业设计做网站用php好吗人员优化方案怎么写
  • 手机网站的推广如何建立网站
  • 手机测评做视频网站百度趋势搜索大数据
  • 百度网站优化 件网站推广在线推广
  • 咋样做网站深圳网络推广系统
  • emlog怎么做视频网站百度 营销推广怎么做
  • 北京专业网站维护公司泉州网站seo外包公司