随笔分类 - 线段树 & 树状数组 & RMQ
摘要:NecklaceTime Limit: 15000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2083Accepted Submission(s): 747Problem DescriptionMery has a beautiful necklace. The necklace is made up of N magic balls. Each ball has a beautiful value. The balls with the same beautiful v
阅读全文
摘要:See you~Time Limit: 5000/3000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2736Accepted Submission(s): 873Problem DescriptionNow I am leaving hust acm. In the past two and half years, I learned so many knowledge about Algorithm and Programming, and I met so many good
阅读全文
摘要:GroupTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 208Accepted Submission(s): 122Problem DescriptionThere are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i-1 are friends, Whose ID is i and i+1 are friends. These n men s
阅读全文
摘要:CubeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 1166Accepted Submission(s): 580Problem DescriptionGiven an N*N*N cube A, whose elements are either 0 or 1. A[i, j, k] means the number in the i-th row , j-th column and k-th layer. Initially we h
阅读全文
摘要:Ping pongTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2611Accepted Submission(s): 973Problem DescriptionN(3#include#includeusing namespace std;const int N=100010;int n,arr[N+10],a[N+10];int lmin[N+10],lmax[N+10],rmin[N+10],rmax[N+10];int lowbit(
阅读全文
摘要:Color the ballTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5397Accepted Submission(s): 2882Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a #include#includeusing namespace std;const int N=100010;int n,arr[N],level[N];int lowbit(int
阅读全文
摘要:Find the nondecreasing subsequencesTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1072Accepted Submission(s): 370Problem DescriptionHow many nondecreasing subsequences can you find in the sequence S = {s1, s2, s3, ...., sn} ? For example, we assu
阅读全文
摘要:美素数Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 374Accepted Submission(s): 159Problem Description 小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题,今天,小明想考考你对素数的认识。 问题是这样的:一个十进制数,如果是素数,而且它的各位数字和也是素数,则称之为“美素数”,如29,本身是素数,而且2+9 = 11也是素数,所以它是美素数。 给定一个区间,你能计算出这个区间内有...
阅读全文
摘要:Count ColorTime Limit:1000MSMemory Limit:65536KTotal Submissions:29895Accepted:8919DescriptionChosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.There is a very long board with length L centimeter, L is a posit
阅读全文
摘要:Frequent valuesTime Limit:2000MSMemory Limit:65536KTotal Submissions:11083Accepted:4063DescriptionYou are given a sequence ofnintegersa1, a2, ... , anin non-decreasing order. In addition to that, you are given several queries consisting of indicesiandj(1 ≤ i ≤ j ≤ n). For each query, determine the m
阅读全文
摘要:Mayor's postersTime Limit:1000MSMemory Limit:65536KTotal Submissions:32200Accepted:9347DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally
阅读全文
摘要:HotelTime Limit:5000MSMemory Limit:30000KTotal Submissions:1584Accepted:645DescriptionThe "Informatics" hotel is one of the most luxurious hotels from Galaciuc. A lot of tourists arrive or leave this hotel in one year. So it is pretty difficult to keep the evidence of the occupied rooms. B
阅读全文
摘要:Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11425Accepted Submission(s): 5650Problem 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
阅读全文
摘要:HotelTime Limit:3000MSMemory Limit:65536KTotal Submissions:8736Accepted:3701DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent, has named the Bullmoose Hotel
阅读全文
摘要:Tunnel WarfareTime Limit:1000MSMemory Limit:131072KTotal Submissions:5985Accepted:2440DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except the
阅读全文
摘要:Multiply gameTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1055Accepted Submission(s): 343Problem DescriptionTired of playing computer games, alpc23 is planning to play a game on numbers. Because plus and subtraction is too easy for this gay, he
阅读全文
摘要:Count the ColorsTime Limit:2 Seconds Memory Limit:65536 KBPainting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last.InputThe first line of each data set contains exa
阅读全文
摘要:City HorizonTime Limit:2000MSMemory Limit:65536KTotal Submissions:14887Accepted:4006DescriptionFarmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildings.The entire horizon is repr
阅读全文
摘要:Apple TreeTime Limit:2000MSMemory Limit:65536KTotal Submissions:15440Accepted:4571DescriptionThere is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree.The tree hasNforks w
阅读全文
摘要:CowsTime Limit:3000MSMemory Limit:65536KTotal Submissions:9618Accepted:3153DescriptionFarmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his field is particularly good.Farmer John has N cows (we numbe
阅读全文