
数据结构——线段树
文章平均质量分 71
爱我俊杰
啦啦啦~
展开
-
GSS4 - Can you answer these queries IV
You are given a sequence A of N(N 18. On this sequence you have to apply M (M (A) For given x,y, for each elements between the x-th and the y-th ones (inclusively, counting from 1), modify it to its p原创 2016-09-09 13:40:48 · 261 阅读 · 0 评论 -
GSS5 - Can you answer these queries V
You are given a sequence A[1], A[2], ..., A[N] . ( |A[i]| <= 10000 , 1 <= N <= 10000 ). A query is defined as follows: Query(x1,y1,x2,y2) = Max { A[i]+A[i+1]+...+A[j] ; x1 <= i <= y1 , x2 <= j <= y2 a转载 2016-09-09 17:35:19 · 338 阅读 · 0 评论 -
GSS1 - Can you answer these queries I(动态查询区间最大连续和)
GSS1 - Can you answer these queries I #tree You are given a sequence A[1], A[2], ..., A[N] . ( |A[i]| ≤ 15007 , 1 ≤ N ≤ 50000 ). A query is defined as follows: Query(x,y) = Max { a[i]+a[原创 2016-09-06 19:13:47 · 879 阅读 · 0 评论 -
POJ 1389 求矩形面积并(线段树)
Area of Simple Polygons Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3436 Accepted: 1771 Description There are N, 1 <= N <= 1,000 rectangles in the 2-D xy原创 2016-06-03 15:36:51 · 462 阅读 · 0 评论 -
GSS2 - Can you answer these queries II(线段树)
题意:询问任意区间内,最大连续序列和(相等的值不重复计算),可以不选输出0; 这题可以说一眼看出是线段树了,可是怎么构造确实非常难. 现在假设线段树中的叶子为 s[i]. 每次更新 a[i]的时候,s[1] -s[i]区间内加上a[i];那么 s[1] = a[1] + a[2] + a[3] + ... + a[i]; s[2] = a[2] + a[3] + ... + a[i]转载 2016-09-06 23:29:47 · 259 阅读 · 0 评论 -
GSS3 - Can you answer these queries III
You are given a sequence A of N (N modify the i-th element in the sequence or for given x y print max{Ai + Ai+1 + .. + Aj | x Input The first line of input contains an integer N. The following原创 2016-09-07 01:02:58 · 376 阅读 · 0 评论