随笔分类 -  线段树-Segment Tree

摘要:Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14578Accepted Submission(s): 7203Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecu 阅读全文
posted @ 2014-03-02 22:15 偶尔会寂寞 阅读(205) 评论(0) 推荐(0)
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8663 Accepted Submission(s): 3862Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The boar... 阅读全文
posted @ 2014-03-01 20:32 偶尔会寂寞 阅读(221) 评论(0) 推荐(0)
摘要:Color the BallTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4028 Accepted Submission(s): 999Problem DescriptionThere are infinite balls in a line (numbered 1 2 3 ....), and initially all of them are paint black. Now Jim use a brush paint t... 阅读全文
posted @ 2014-02-26 18:49 偶尔会寂寞 阅读(292) 评论(0) 推荐(0)
摘要:Color the ballTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7117 Accepted Submission(s): 3688Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a #include#include#include#define MAX 100002#define MAXN 400005using namespace std;str... 阅读全文
posted @ 2014-02-26 10:41 偶尔会寂寞 阅读(195) 评论(0) 推荐(0)
摘要:问题描述有n个格子,从左到右放成一排,编号为1-n。共有m次操作,有3种操作类型:1.修改一个格子的权值,2.求连续一段格子权值和,3.求连续一段格子的最大值。对于每个2、3操作输出你所求出的结果。输入格式第一行2个整数n,m。接下来一行n个整数表示n个格子的初始权值。接下来m行,每行3个整数p,x,y,p表示操作类型,p=1时表示修改格子x的权值为y,p=2时表示求区间[x,y]内格子权值和,p=3时表示求区间[x,y]内格子最大的权值。输出格式有若干行,行数等于p=2或3的操作总数。每行1个整数,对应了每个p=2或3操作的结果。样例输入4 31 2 3 42 1 31 4 33 1 4样例 阅读全文
posted @ 2014-02-06 15:19 偶尔会寂寞 阅读(206) 评论(1) 推荐(0)