随笔分类 -  线段树

摘要:SuccessorTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1779Accepted Submission(s): 426 Problem DescriptionSean owns a company and he is the BOSS.The other Staff has one Superior.every staff has a loyalty and ability.Some times Sean will fire one 阅读全文
posted @ 2013-07-22 18:33 剑不飞 阅读(365) 评论(0) 推荐(0)
摘要:N(3N20000)ping pong players live along a west-east street(consider the street as a line segment). Each player has a unique skill rank. To improve their skill rank, they often compete with each other. If two players want to compete, they must choose a referee among other ping pong players and hold th 阅读全文
posted @ 2013-07-06 20:44 剑不飞 阅读(183) 评论(0) 推荐(0)
摘要:QueryTime Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1956Accepted Submission(s): 670Problem DescriptionYou are given two strings s1[0..l1], s2[0..l2] and Q - number of queries.Your task is to answer next queries:1) 1 a i c - you should set i-th c 阅读全文
posted @ 2013-06-22 18:58 剑不飞 阅读(195) 评论(0) 推荐(0)
摘要:Holedox EatingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2341Accepted Submission(s): 792Problem DescriptionHoledox is a small animal which can be considered as one point. It lives in a straight pipe whose length is L. Holedox can only move alo 阅读全文
posted @ 2013-05-23 19:09 剑不飞 阅读(259) 评论(0) 推荐(0)
摘要:Longest Non-decreasing SubstringTime Limit 1000msMemory Limit 65536KdescriptionYou are given a string S no longer than 100,000 consisting of characters 0-9 only. And two kinds of operations will be performed on S: Flip i j: for each i #include #include #include #define lson t=rt[rson].lz)///中间可递减 .. 阅读全文
posted @ 2013-05-11 16:50 剑不飞 阅读(197) 评论(0) 推荐(0)
摘要:Car race gameTime Limit 1000msMemory Limit 65536Kdescription Bob is a game programming specialist. In his new car race game, there are some racers(n means the amount of racers (1 output For each data set in the input print on a separate line, on the standard output, the integer that represe... 阅读全文
posted @ 2013-05-05 14:19 剑不飞 阅读(242) 评论(0) 推荐(0)
摘要:基础知识点;所谓线段树,也就是一颗树,不过这棵树数管的是一个线段,而原本的树管的只是不同的点,其实本质上是一个道理。线段树算法主要由三部分组成,1建树,2更新3查询。就以其中第一题为例子#define lson t=id)update(lson,id,num); else update(rson,id,num); rt[t].beauty=rt[lson].beauty+rt[rson].beauty; }}/**询问某个区间,或某个点的具体情况*/int query(int t,int l,int r)///这是查询过程{ if(rt[t].l==l&&rt[t].r==r) 阅读全文
posted @ 2013-04-01 12:23 剑不飞 阅读(217) 评论(0) 推荐(0)
摘要:Color the ballTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4961Accepted Submission(s): 2624Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a #include #include #define lson t=r)update(lson,l,r,rt[t].lazy+num); else if(rt[rson].l=id... 阅读全文
posted @ 2013-03-31 16:01 剑不飞 阅读(140) 评论(0) 推荐(0)
摘要:Ultra-QuickSortTime Limit: 7000MSMemory Limit: 65536KTotal Submissions: 27736Accepted: 9946DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted 阅读全文
posted @ 2012-08-11 20:31 剑不飞 阅读(171) 评论(0) 推荐(0)
摘要:三国之战 Time Limit 1000 Memory Limit 65536 description 在三国某某战争中,魏军要围攻蜀国. ,诸葛亮亲自指挥战争,对抗曹操。现假设诸葛亮有N个大炮,每个大炮都有一个攻击值ai(ai>=0 &&ai=0 && x#include#include#include#define N 100030using namespace std;class node{ public: int l,r; int sum,lazy; bool flag;}root[4*N];int shu[N];void build(int t, 阅读全文
posted @ 2012-08-08 15:12 剑不飞 阅读(186) 评论(0) 推荐(0)
摘要:H - A Simple Problem with IntegersCrawling in process...Crawling failedTime Limit:5000MS Memory Limit:131072KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionYou have N integers, A1,A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number 阅读全文
posted @ 2012-08-07 19:30 剑不飞 阅读(128) 评论(0) 推荐(0)
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4292 Accepted Submission(s): 2003Problem 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 board is t 阅读全文
posted @ 2012-08-07 17:13 剑不飞 阅读(153) 评论(0) 推荐(0)
摘要:FlowersTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1076 Accepted Submission(s): 535Problem DescriptionAs is known to all, the blooming time and duration varies between different kinds of flowers. Now there is a garden planted full of flowers. 阅读全文
posted @ 2012-08-06 17:21 剑不飞 阅读(227) 评论(0) 推荐(0)
摘要:Man DownTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1171 Accepted Submission(s): 400Problem DescriptionThe Game “Man Down 100 floors” is an famous and interesting game.You can enjoy the game fromhttp://hi.baidu.com/abcdxyzk/blog/item/16398781b 阅读全文
posted @ 2012-08-06 14:23 剑不飞 阅读(154) 评论(0) 推荐(0)
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17672 Accepted Submission(s): 7704Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的 阅读全文
posted @ 2012-08-05 18:54 剑不飞 阅读(163) 评论(0) 推荐(0)