
----树状数组
文章平均质量分 80
_Occult_
物語が始まった
展开
-
HDU 4267 A Simple Problem with Integers
Problem DescriptionLet A1, A2, ... , AN be N elements. You need to deal with two kinds of operations. One type of operation is to add a given number to a few numbers in a given interval. The other原创 2015-02-20 19:32:45 · 458 阅读 · 0 评论 -
PAT (Top Level) Practise 1009 Triple Inversions (35)
1009. Triple Inversions (35)时间限制300 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CAO, PengGiven a list of N integers A1, A2, A3,...原创 2016-02-28 12:23:43 · 820 阅读 · 0 评论 -
PAT (Top Level) Practise 1010 Lehmer Code (35)
1010. Lehmer Code (35)时间限制300 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者LIU, YaotingAccording to Wikipedia: "In mathematics and原创 2016-03-15 17:12:43 · 1228 阅读 · 0 评论 -
HDU 5654 xiaoxin and his watermelon candy
Problem DescriptionDuring his six grade summer vacation, xiaoxin got lots of watermelon candies from his leader when he did his internship at Tencent. Each watermelon candy has it's sweetness whic原创 2016-03-26 23:07:55 · 1729 阅读 · 1 评论 -
HDU 5748 Bellovin
Problem DescriptionPeter has a sequence a1,a2,...,an and he define a function on the sequence -- F(a1,a2,...,an)=(f1,f2,...,fn), where fi is the length of the longest increasing subsequence原创 2016-07-25 16:44:27 · 570 阅读 · 0 评论 -
HDU 5775 Bubble Sort
Problem Description?? gets an sequence S with n intergers(0 < n <= 100000,0<= S[i] <= 1000000).?? has a magic so that he can change 0 to any interger(He does not need to change all 0 to the same i原创 2016-07-30 12:57:34 · 337 阅读 · 0 评论 -
HDU 5791 Two
Problem DescriptionAlice gets two sequences A and B. A easy problem comes. How many pair of sequence A' and sequence B' are same. For example, {1,2} and {1,2} are same. {1,2,4} and {1,4,2} are not原创 2016-08-03 16:48:31 · 442 阅读 · 0 评论 -
HDU 5792 World is Exploding
Problem DescriptionGiven a sequence A with length n,count how many quadruple (a,b,c,d) satisfies: a≠b≠c≠d,1≤ab≤n,1≤cd≤n,AaAb,Ac>Ad. InputThe input consists of multiple test cases.原创 2016-08-03 16:50:59 · 390 阅读 · 0 评论 -
HDU 5273 Dylans loves sequence
Problem DescriptionDylans is given N numbers a[1]....a[N]And there are Q questions.Each question is like this (L,R)his goal is to find the “inversions” from number L to number R.原创 2015-06-21 00:16:35 · 597 阅读 · 0 评论 -
HDU 4911 Inversion
Descriptionbobo has a sequence a 1,a 2,…,a n. He is allowed to swap two adjacent numbers for no more than k times. Find the minimum number of inversions after his swaps. Note: The number o原创 2016-08-27 19:42:55 · 566 阅读 · 0 评论 -
HDU 5869 Different GCD Subarray Query
Problem DescriptionThis is a simple problem. The teacher gives Bob a list of problems about GCD (Greatest Common Divisor). After studying some of them, Bob thinks that GCD is so interesting. One d原创 2016-09-11 21:43:53 · 376 阅读 · 0 评论 -
CSU 1811 Tree Intersection
DescriptionBobo has a tree with n vertices numbered by 1,2,…,n and (n-1) edges. The i-th vertex has color ci, and the i-th edge connects vertices ai and bi.Let C(x,y) denotes the set of colors原创 2016-09-04 15:18:28 · 1162 阅读 · 2 评论 -
HDU 4777 Rabbit Kingdom
Description Long long ago, there was an ancient rabbit kingdom in the forest. Every rabbit in this kingdom was not cute but totally pugnacious, so the kingdom was in chaos in season and out of se原创 2016-10-30 00:11:14 · 417 阅读 · 0 评论 -
Codeforces Gym 101142G
#include#include#include#includeusing namespace std;const int N=1e6+10;int n,q;int to[N],nx[N],h[N],sz;int dep[N][25];int L[N],R[N],b[N],c[N];int g[N],f[N],t[N];set s[N];set::iterator it;原创 2016-11-19 22:20:13 · 618 阅读 · 0 评论 -
HDU 5997 rausen loves cakes
问题描述rausen喜欢吃蛋糕。某天,他买了nn个蛋糕,每个蛋糕都有一个颜色,用\left[1,1000000 \right][1,1000000]中的整数来表示。rausen将它们从左到右排成一行,然后准备开始吃。在吃之前,rausen想对蛋糕进行qq个操作。某些时刻,rausen会把所有颜色为xx的蛋糕替换成颜色为yy的蛋糕。另一些时刻,rausen会计算一段区间\left[x原创 2016-12-18 14:09:40 · 788 阅读 · 0 评论 -
PAT (Top Level) Practise 1017 The Best Peak Shape (35)
1017. The Best Peak Shape (35)时间限制1000 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, YueIn many research areas, one important原创 2017-03-04 19:33:29 · 1560 阅读 · 0 评论 -
CodeForces 15D Map
DescriptionThere is an area map that is a rectangular matrix n × m, each cell of the matrix contains the average height of a corresponding area part. Peter works for a company that has to build原创 2016-04-03 15:01:15 · 648 阅读 · 0 评论 -
POJ 2828 Buy Tickets
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little原创 2016-02-20 15:51:01 · 3189 阅读 · 0 评论 -
HDU 1166 敌兵布阵
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视原创 2015-02-20 17:30:58 · 648 阅读 · 0 评论 -
HDU 4000 Fruit Ninja
Problem DescriptionRecently, dobby is addicted in the Fruit Ninja. As you know, dobby is a free elf, so unlike other elves, he could do whatever he wants.But the hands of the elves are somehow str原创 2015-02-20 17:01:33 · 500 阅读 · 0 评论 -
HDU 2852 KiKi's K-Number
Problem DescriptionFor the k-th number, we all should be very familiar with it. Of course,to kiki it is also simple. Now Kiki meets a very similar problem, kiki wants to design a container, the co原创 2015-02-20 13:21:05 · 473 阅读 · 0 评论 -
HDU 1541 Stars
Problem DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars t原创 2015-02-21 16:43:15 · 425 阅读 · 0 评论 -
HDU 1892 See you~
Problem 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 friends. I want to say sorry to Mr原创 2015-02-21 17:45:00 · 471 阅读 · 0 评论 -
HDU 3584 Cube
Problem 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 have A[i, j, k] = 0 (1 We defin原创 2015-02-20 15:22:04 · 555 阅读 · 0 评论 -
HDU 3887 Counting Offspring
Font Size: ← →Problem DescriptionYou are given a tree, it’s root is p, and the node is numbered from 1 to n. Now define f(i) as the number of nodes whose number is less than i in all the succe原创 2015-02-19 16:34:49 · 539 阅读 · 0 评论 -
HDU 4358 Boring counting
Problem DescriptionIn this problem we consider a rooted tree with N vertices. The vertices are numbered from 1 to N, and vertex 1 represents the root. There are integer weights on each vectice. Yo原创 2015-02-24 17:04:57 · 1106 阅读 · 0 评论 -
HDU 3074 Multiply game
Problem 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 wants to do some multiplication in a num原创 2015-02-25 20:37:40 · 756 阅读 · 0 评论 -
HDU 3450 Counting Sequences
Problem DescriptionFor a set of sequences of integers{a1,a2,a3,...an}, we define a sequence{ai1,ai2,ai3...aik}in which 1<=i1<i2<i3<...<ik<=n, as the sub-sequence of {a1,a2,a3,...an}. It is quite o原创 2015-02-26 16:54:20 · 752 阅读 · 0 评论 -
HDU 3333 Turing Tree
Problem DescriptionAfter inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily have the solution. As well, wily 3xian made lots of原创 2015-02-26 00:07:26 · 604 阅读 · 0 评论 -
HDU 1394 Minimum Inversion Number
Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, ..., an, if we mov原创 2015-02-20 19:56:13 · 372 阅读 · 0 评论 -
HDU 5372 Segment Game
Problem DescriptionLillian is a clever girl so that she has lots of fans and often receives gifts from her fans.One day Lillian gets some segments from her fans Lawson with lengths of 1,2,3...原创 2015-08-11 19:53:33 · 567 阅读 · 0 评论 -
POJ 3416 Crossing
DescriptionWintokk has collected a huge amount of coins at THU. One day he had all his coins fallen on to the ground. Unfortunately, WangDong came by and decided to rob Wintokk of the coins.Th原创 2015-08-01 23:10:55 · 611 阅读 · 0 评论 -
HDU 5497 Inversion
Problem DescriptionYou have a sequence {a_1,a_2,...,a_n}{a1,a2,...,an} and you can delete a contiguous subsequence of length mm. So what is the minimum number of inversions after the原创 2015-10-05 17:15:07 · 435 阅读 · 0 评论 -
HDU 5618 Jam's problem again
Problem DescriptionJam like to solve the problem which on the 3D-axis,given N(1≤N≤100000) points (x,y,z)(1≤x,y,z≤100000)If two point such as (xi,yi,zi) and (xj,yj,zj) xi≥xj yi≥yj zi≥zj, the原创 2016-02-01 22:20:23 · 1323 阅读 · 1 评论 -
HDU 5927 Auxiliary Set
Given a rooted tree with n vertices, some of the vertices are important. An auxiliary set is a set containing vertices satisfying at least one of the two conditions: ∙∙It is an important ver原创 2017-11-08 15:36:46 · 299 阅读 · 0 评论