![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
----线段树
文章平均质量分 84
_Occult_
物語が始まった
展开
-
HDU 5930 GCD
Mr. Frog likes generating numbers! He can generate many numbers from a sequence. For a given sequence a1,a2,⋯,ana1,a2,⋯,an Mr. Frog can choose two numbers l and r (1≤l≤r≤n1≤l≤r≤n) and calculat原创 2017-11-08 15:43:17 · 337 阅读 · 0 评论 -
HDU 5875 Function
Problem DescriptionThe shorter, the simpler. With this problem, you should be convinced of this truth. You are given an array A of N postive integers, and M queries in the form (l,r).原创 2016-09-11 20:51:13 · 638 阅读 · 0 评论 -
HDU 5790 Prefix
Problem DescriptionAlice gets N strings. Now she has Q questions to ask you. For each question, she wanna know how many different prefix strings between Lth and Rth strings. It's so easy right? So原创 2016-08-08 18:16:59 · 362 阅读 · 0 评论 -
HDU 5726 GCD
Problem DescriptionGive you a sequence of N(N≤100,000) integers : a1,...,an(0ai≤1000,000,000). There are Q(Q≤100,000) queries. For each query l,r you have to calculate gcd(al,,al+1,...,ar)原创 2016-07-19 18:39:33 · 1337 阅读 · 0 评论 -
HDU 5722 Jewelry
Problem DescriptionAfter all the difficulties, Psyche and Cupid are finally getting married.No ordinary pearls can hold Cupid's love for Psyche. So he has collected the Jewelry of Gods at the原创 2016-07-18 19:29:57 · 492 阅读 · 0 评论 -
HDU 5700 区间交
Problem Description小A有一个含有n个非负整数的数列与m个区间。每个区间可以表示为li,ri。它想选择其中k个区间, 使得这些区间的交的那些位置所对应的数的和最大。例如样例中,选择[2,5]与[4,5]两个区间就可以啦。 Input多组测试数据第一行三个数n,k,m(1≤n≤100000,1≤k≤m≤100000原创 2016-05-22 22:49:45 · 734 阅读 · 0 评论 -
HDU 5692 Snacks
Problem Description百度科技园内有n个零食机,零食机之间通过n−1条路相互连通。每个零食机都有一个值v,表示为小度熊提供零食的价值。由于零食被频繁的消耗和补充,零食机的价值v会时常发生变化。小度熊只能从编号为0的零食机出发,并且每个零食机至多经过一次。另外,小度熊会对某个零食机的零食有所偏爱,要求路线上必须有那个零食机。为小度熊规划一个路线,使得路线上的价原创 2016-05-21 19:13:53 · 842 阅读 · 0 评论 -
ZOJ 3943 Himalayas
HimalayasTime Limit: 5 Seconds Memory Limit: 65536 KBThe Himalayas or Himalaya is a mountain range in the Indian subcontinent, which separates the Indo-Gangetic Plain from the Tibetan Pla原创 2016-04-23 23:01:51 · 1038 阅读 · 0 评论 -
HDU 5678 ztr loves trees
Problem DescriptionSuper Deity ztr likes trees from childhood,CCTV-children:"The apple on the apple tree.You and I under the apple tree.Play games in front of the apple tree.So many happiness".原创 2016-05-03 13:03:21 · 521 阅读 · 0 评论 -
FZU 2105 Digits Count
DescriptionGiven N integers A={A[0],A[1],...,A[N-1]}. Here we have some operations:Operation 1: AND opn L RHere opn, L and R are integers.For L≤i≤R, we do A[i]=A[i] AND opn (here "AND" is bi原创 2016-03-10 18:46:47 · 522 阅读 · 0 评论 -
POJ 2104 K-th Number
DescriptionYou are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be ab原创 2016-02-13 15:32:41 · 599 阅读 · 0 评论 -
CodeForces 19D Points
DescriptionPete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, O原创 2016-04-01 21:58:16 · 581 阅读 · 0 评论 -
HDU 5877 Weak Pair
Problem DescriptionYou are given a rooted tree of N nodes, labeled from 1 to N. To the ith node a non-negative value ai is assigned.An ordered pair of nodes (u,v) is said to be weak原创 2016-09-11 21:34:50 · 484 阅读 · 0 评论 -
POJ 3667 Hotel
DescriptionThe 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,原创 2016-09-01 18:28:16 · 302 阅读 · 0 评论 -
HDU 4867 Xor
Given n non-negative integers , We define a statistical function as follows: It will be noted that the nature of F(k) is calculated with the number of choices, such that: 1)0≤b i≤a i,0≤i≤n-1,b原创 2017-02-22 16:43:53 · 954 阅读 · 0 评论 -
HDU 4866 Shooting
In the shooting game, the player can choose to stand in the position of 1,X1,X to shoot, you can shoot all the nearest K targets. The value of K may be different on different shootings. There are N原创 2017-02-21 21:40:28 · 341 阅读 · 0 评论 -
ZOJ 3606 Lazy Salesgirl
DescriptionKochiya Sanae is a lazy girl who makes and sells bread. She is an expert at bread making and selling. She can sell the i-th customer some pieces of bread at price pi for each piece. But原创 2016-04-21 21:16:14 · 378 阅读 · 0 评论 -
ZOJ 3324 Machine
Mee is the only genius engineer in country Nii who is fond of making machines. One day, when he was working with his research, an amazing idea thrilled through his head and he decided to make a powerf原创 2017-02-19 17:31:37 · 416 阅读 · 0 评论 -
HYSBZ 2588 Spoj 10628. Count on a tree
Description给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权。其中lastans是上一个询问的答案,初始为0,即第一个询问的u是明文。Input第一行两个整数N,M。第二行有N个整数,其中第i个整数表示点i的权值。后面N-1行每行两个整数(x,y),原创 2016-11-22 19:49:27 · 333 阅读 · 0 评论 -
UVALive 7141 BombX
2014上海区域赛的D题,十分复杂的感觉。按照x坐标排序,对于炸弹来说,不考虑y坐标的情况,可以看成数轴上的一个线段,当线段向右移动的时候,可以知道每一个时刻,线段上有多少的点,这一点显然可以用twopoint搞定O(n)得到。然后对于每一个时刻,炸弹能炸的最多的数量,显然是当前在线段上的点,以及不在线段上的点里,用H能覆盖的最多的情况,当然,要去掉不能覆盖的那些位置。这一点,原创 2016-10-27 20:46:42 · 456 阅读 · 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 · 1110 阅读 · 2 评论 -
HDU 5828 Rikka with Sequence
Problem DescriptionAs we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:Yuta has an array A with n numb原创 2016-08-11 21:02:22 · 716 阅读 · 2 评论 -
HDU 5862 Counting Intersections
Problem DescriptionGiven some segments which are paralleled to the coordinate axis. You need to count the number of their intersection.The input data guarantee that no two segments share the s原创 2016-08-24 14:38:08 · 473 阅读 · 0 评论 -
HDU 5381 The sum of gcd
DescriptionYou have an array ,the length of is Let InputThere are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. Fo原创 2016-09-02 18:11:14 · 528 阅读 · 0 评论 -
HDU 5634 Rikka with Phi
Problem DescriptionRikka and Yuta are interested in Phi function (which is known as Euler's totient function).Yuta gives Rikka an array A[1..n] of positive integers, then Yuta makes m querie原创 2016-02-20 23:00:28 · 823 阅读 · 2 评论 -
HDU 1166 敌兵布阵
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视原创 2015-02-20 17:30:58 · 617 阅读 · 0 评论 -
PAT (Advanced Level) Practise 1057 Stack (30)
1057. Stack (30)时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueStack is one of the most fundamental data structures原创 2016-03-16 16:52:18 · 492 阅读 · 0 评论 -
HDU 1199 Color the Ball
Problem 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 the balls, every time give two integers a b and fo原创 2015-08-11 22:08:37 · 615 阅读 · 0 评论 -
HDU 5367 digger
Problem DescriptionAFa have n mountains. These mountains in a line。All of mountains have same height initially. Every day , AFa would request ZJiaQ to cut some mountains or put stones in some moun原创 2015-08-09 22:33:52 · 742 阅读 · 0 评论 -
POJ 2528 Mayor's posters
DescriptionThe 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 coun原创 2015-08-09 17:44:18 · 369 阅读 · 0 评论 -
POJ 2374 Fence Obstacle Course
DescriptionFarmer John has constructed an obstacle course for the cows' enjoyment. The course consists of a sequence of N fences (1 The door to FJ's barn is at the origin (marked '*' below).原创 2015-08-09 15:31:05 · 527 阅读 · 0 评论 -
HDU 5316 Magician
Problem DescriptionFantasy magicians usually gain their ability through one of three usual methods: possessing it as an innate talent, gaining it through study and practice, or receiving it from a原创 2015-07-28 21:16:16 · 795 阅读 · 0 评论 -
ZOJ 3886 Nico Number
DescriptionKousaka Honoka and Minami Kotori are playing a game about a secret of Yazawa Nico.When the game starts, Kousaka Honoka will give Minami Kotori an array A of N non-negative integers. T原创 2015-07-28 11:15:32 · 619 阅读 · 0 评论 -
ACdream 1427 Nice Sequence
Description Let us consider the sequence a1, a2,..., an of non-negative integer numbers. Denote as ci,j the number of occurrences of the number i among a1,a2,..., aj. We call the sequence原创 2015-05-22 15:40:20 · 488 阅读 · 0 评论 -
HDU 4605 Magic Ball Game
Font Size: ← →Problem DescriptionWhen the magic ball game turns up, Kimi immediately falls in it. The interesting game is made up of N balls, each with a weight of w[i]. These N balls form a r原创 2015-05-13 15:17:42 · 553 阅读 · 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 · 357 阅读 · 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 · 721 阅读 · 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 · 707 阅读 · 0 评论 -
HDU 3397 Sequence operation
Problem Descriptionlxhgww got a sequence contains n characters which are all '0's or '1's.We have five operations here:Change operations:0 a b change all characters into '0's in [a , b]1 a原创 2015-08-12 13:41:19 · 306 阅读 · 0 评论 -
HDU 1542 Atlantis
Problem DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, t原创 2015-08-12 17:14:07 · 433 阅读 · 0 评论