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

网站建设视频教程wordpress插件重写

网站建设视频教程,wordpress插件重写,哪个网站可以领手工回家做,网络空间设计说明怎么写https://www.luogu.com.cn/problem/CF1762F 分析性质,就是我们选的数要么递增,要么递减(非严格)然后很明细是ds套dp, f i f_i fi​ 表示以 i i i 开头的答案然后考虑如何转移(ds套dp难点反而在转移而不是…

https://www.luogu.com.cn/problem/CF1762F

  • 分析性质,就是我们选的数要么递增,要么递减(非严格)
  • 然后很明细是ds套dp, f i f_i fi 表示以 i i i 开头的答案
  • 然后考虑如何转移(ds套dp难点反而在转移而不是状态,因为要考虑如何和ds结合)
  • 转移的话,要么从位置考虑,要么从值域考虑
  • 从值域考虑,就从后面比它大且最小的转移,似乎不知道怎么搞
  • 从位置考虑,就是从第一个在 [ a i , a i + k ] [a_i,a_i+k] [ai,ai+k] 内的数转移。我们考虑会漏掉值域在 [ a i + 1 , a j − 1 ] [a_i+1,a_j-1] [ai+1,aj1] 的数,但这可以直接套ds来做了。至于大于 a j a_j aj 的会在 f j f_j fj 里算
#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
//mt19937 rand(time(0));
//mt19937_64 rand(time(0));
//srand(time(0));
#define N 500010
//#define M
//#define mo
struct node {int x, id; bool operator < (const node &A) const {return id < A.id; }
}b[N]; 
int n, m, i, j, k, T;
int ans, a[N], mp[N], nxt[N], f[N], l; 
set<node>s; 
set<node>::iterator it; struct Binary_tree {int cnt[N]; void add(int x, int y) {while(x<N) cnt[x]+=y, x+=x&-x; }int que(int x) {int ans = 0; while(x) ans+=cnt[x], x-=x&-x; return ans; }
}Bin;void calc() {for(i=1; i<=n; ++i) b[i].x = a[i], b[i].id = i; 	auto cmp = [&] (node x, node y) -> bool {if(x.x == y.x) return x.id > y.id; return x.x > y.x; }; sort(b+1, b+n+1, cmp); s.clear(); for(i=l=1; i<=n; ++i) {while(b[l].x>b[i].x+k) s.erase(b[l]), ++l; it = s.upper_bound({0, b[i].id}); if(it == s.end()) nxt[b[i].id] = 0;  else nxt[b[i].id] = (it -> id); s.insert(b[i]); }
//	for(i = 1; i <= n; ++i) printf("%d ", nxt[i]); printf("\n"); for(i=n; i>=1; --i) {j=nxt[i]; f[i]=f[j]+1; if(nxt[i]==0) f[i]+=Bin.que(a[i]+k)-Bin.que(a[i]-1); else f[i]+=Bin.que(a[nxt[i]]-1)-Bin.que(a[i]-1); ans+=f[i]; Bin.add(a[i], 1); 
//		printf("%lld (%lld %lld)", f[i], f[j]); }
//	printf("\n"); for(i=1; i<=n; ++i) Bin.add(a[i], -1); 
}signed main()
{
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);T=read();while(T--) {n=read(); k=read(); ans=0; for(i=1; i<=n; ++i) {a[i]=read(), mp[a[i]]++, ans-=mp[a[i]]; }
//		printf("> %lld\n", ans); `calc(); reverse(a+1, a+n+1); calc(); for(i=1; i<=n; ++i) mp[a[i]]=0; printf("%lld\n", ans); }return 0;
}
http://www.dtcms.com/wzjs/825647.html

相关文章:

  • 58同城上海网站建设小白学做搭建网站
  • 网站毕业设计答辩问题wordpress 评论加星
  • 网站连接微信简单的电影网站模板
  • 网站运营策划书范文企业门户网站主要功能
  • 网站怎么申请支付宝采购平台网
  • 好看简单易做的网站全球搜效果怎么样
  • 白云做网站公司广西远伟网络科技有限公司
  • 网站目录改版陇西做网站的广告店
  • 站内推广策略外贸SOHO建公司网站
  • 广州网站建设q.479185700強安康市燃气公司电话
  • 免费搭建网站 优帮云深圳设计周2021时间
  • 寿光市建设局网站今天泰安刚刚发生的新闻
  • 城阳建网站怎么样可以做网站
  • 网站改版意见方案互动 网站建设
  • 网站建设技术服务方案查企业的app软件 排名
  • 网网站设计网做网站必须用tomcat
  • 网站排名提升工具开发板组装实验报告
  • 德国 网站后缀克拉玛依建设局网站
  • 快速建设企业网站wordpress食谱门户
  • 做网站百科温州建站程序
  • 烟台市做网站河北怀来县建设局网站
  • 网站开发英文松松软文平台
  • 宁德建设网站网站底部图片代码
  • 网站首页英文天津企业建网站
  • 建一个产品介绍网站广东省建设行业数据开放平台
  • 付第三期网站建设费的账务处理新云网站模版
  • 网站建设swot分析软件技术毕业设计项目
  • 网站建设对企业的好处有哪些centos一键搭建wordpress
  • 企业门户网站的建设与实现论文男女生做恶心的网站
  • 深圳网站建设素材网站黑帽seo工具