hdu 3308】的更多相关文章

LCIS Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6066    Accepted Submission(s): 2634 Problem Description Given n integers.You have two operations:U A B: replace the Ath number by B. (index…
看到讲课安排上 线段树有一节课"区间合并" 我是迷茫的 因为并没有见过 然后了解了一下题目 发现以前写过 还是很麻烦的树链剖分 大概是 解决带修改的区间查询"连续问题" 意思就是给一个数组 要对这个数组进行修改 然后进行区间查询 查询的一般是 l r 区间内的 连续xx 可能是LCIS 也可能只是连续的数字.. 解题的方法比较固定 由于是 连续性 相关 所以对于每个数组 维护它的左边与右边与全局的性质 例如紧靠左(右)边连续xx的长度和这个区间内连续xx的最长长度…
LCIS HDU - 3308 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].  InputT in the first line, indicating…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3308 题目很好懂,就是单点更新,然后求区间的最长上升子序列. 线段树区间合并问题,注意合并的条件是a[mid + 1] > a[mid],写的细心点就好了. #include <iostream> #include <cstring> #include <cstdio> using namespace std; ; struct SegTree { int l , r…
题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=3308 LCIS Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5792    Accepted Submission(s): 2513 Problem Description Given n integers. You have two…
http://acm.hdu.edu.cn/showproblem.php?pid=3308 题意: 两个操作  : 1 修改 单点  a 处的值. 2 求出 区间[a,b]内的最长上升子序列. 做法:线段树区间合并.了解线段树的具体含义很容易. ;  ],Rsum[MAX<<],Msum[MAX<<];  ],Rnum[MAX<<];   ];         Lsum[o]=Lsum[o<<];      Rsum[o]=Rsum[o<<|]…
t 题目大意:给你n个数,m个操作.操作有两种:1.U x y 将数组第x位变为y   2. Q x y 问数组第x位到第y位连续最长子序列的长度.对于每次询问,输出一个答案 #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; #define MAXN 100010 struct node { int l,r,ls,rs,ms;//维护从左边开始 最大 到右边结束 3…
题目链接 模板题吧,忘了好多,终于A了... #include <cstring> #include <cstdio> #include <string> #include <iostream> #include <algorithm> #include <vector> #include <queue> using namespace std; #define maxn 1000000 #define lson l,m,…
题意: U A B: 把第A个数变成BQ A B: 输出[A,B]最长连续上升子序列(注意是连续  相当于子串) 思路:单点更新 ,区间合并几下左边开头最小  和右边结束最大的两个数即可. #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include <iostream> #define lson (i<<1) #define rson…
Problem Description 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].   Input T in the first line, indicati…