博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 3308 LCIS
阅读量:6871 次
发布时间:2019-06-26

本文共 1195 字,大约阅读时间需要 3 分钟。

题意:Given n integers.

        You have two operations:
        U A B: replace the Ath number by B. (index counting from 0)
        Q A B: output the length of the longest consecutive increasing subsequence (LCIS) in [a, b].

分析:区间合并类线段树。

        las[maxn<<2]     区间左端起最长的序列长度

        ras[maxn<<2]    区间右端起最长的序列长度
        mov[maxn<<2]  区间最优值

#include
#include
#include
#define maxn 100005#define clr(x)memset(x,0,sizeof(x))int max(int a,int b){ return a>b?a:b;}int min(int a,int b){ return a
>1; creat(l,mid,rt<<1); creat(mid+1,r,rt<<1|1); pushup(l,r,mid,rt);}void update(int pos,int val,int l,int r,int rt){ if(l==r) { va[l]=val; return; } int mid=(l+r)>>1; if(pos<=mid) update(pos,val,l,mid,rt<<1); else update(pos,val,mid+1,r,rt<<1|1); pushup(l,r,mid,rt);}int query(int L,int R,int l,int r,int rt){ if(L<=l&&r<=R) return mov[rt]; int mid=(l+r)>>1; int res=0; if(R <= mid) return query(L,R,l,mid,rt<<1); else if(L>mid) return query(L,R,mid+1,r,rt<<1|1); else { int tmp=0; if(va[mid]

 

 

转载于:https://www.cnblogs.com/dream-wind/archive/2012/09/25/2703213.html

你可能感兴趣的文章
LeetCode——Largest Number
查看>>
SICP 锻炼 (2.15)解决摘要:深入思考间隔误差
查看>>
安装了XAMPP,PHP怎么显示中文
查看>>
在EO中对数据的重复性进行验证
查看>>
解析大型.NET ERP系统 代码的坏味道
查看>>
shell的定义
查看>>
网络常用的linux系统调用
查看>>
机器学习中的范数规则化之(一)L0、L1与L2范数 非常好,必看
查看>>
浅析代理模式(转)
查看>>
Android TextView中显示图片
查看>>
S5PV210的IRAM应用
查看>>
How To Build Compelling Stories From Your Data Sets
查看>>
Collections.sort的两种用法
查看>>
JS对象的写法
查看>>
Atitit.swt 线程调用ui控件的方法
查看>>
hdu 5428 The Factor 分解质因数
查看>>
svn:database disk image is malformed问题解决方法
查看>>
开源工具DbUtils的使用(数据库的增删改查)
查看>>
Oracle性能分析3:TKPROF简介
查看>>
BZOJ2468 : [中山市选2010]三核苷酸
查看>>