![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树状数组
文章平均质量分 65
Ren_Ivan
衡中oier,fight for furture
展开
-
Poi2010 Monotonicity 2
树状数组优化dp可以证明最优解一定是通过之前的最优转移过来的,所以每一个点只需要保存以该节点为结尾的最长长度即可对于不同符号,等于号维护数组,大于小于维护树状数组#include#include#include#include#include#define N 500005using namespace std;int n,m,a[N],f[N],ans,c[2][2*N],原创 2017-07-27 21:07:46 · 466 阅读 · 0 评论 -
bzoj3594 方伯伯的玉米田 树状数组优化dp
f[i][j]表示到第i位,使用了j次机会的最长不下降子序列长度转移:f[i][j]=max(f[x][y])+1;x所以根据后两个条件维护二维树状数组求最值#include#include#includeusing namespace std;int n,m,k;int a[10005],c[505][5505],f[10005][505];int lowbit(in原创 2017-07-14 21:40:38 · 403 阅读 · 0 评论 -
bzoj3236 作业 莫队+树状数组
莫队+树状数组#include#include#include#include#include#define N 100055#define M 1000066using namespace std;int gy[N],be[N],c[M],cc[M],n,m,nn,maxn,tot,num[N];struct Query{ int l,r,a,b,id,ans1,ans2原创 2017-07-25 21:40:04 · 311 阅读 · 0 评论 -
bzoj 1901 主席树+树状数组
修改+查询第k小值单纯主席树修改会打乱所有,所以再套一个树状数组维护前缀和使得修改,查询都是log对了,bzoj上不需要读入组数,蜜汁re。。#include#include#include#include#includeusing namespace std;int n,m,sz,T,num_tot,num_cnt,num_l,num_r;int sum[8000005原创 2017-08-03 09:51:23 · 239 阅读 · 0 评论