
数据结构
文章平均质量分 72
阿柟的小星星
大学四年,归来一张白纸
展开
-
poj 2352 Stars (树状数组)
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 that are not h原创 2017-07-14 11:17:49 · 275 阅读 · 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 new原创 2017-07-28 09:35:17 · 385 阅读 · 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 able to r原创 2017-07-27 20:33:11 · 277 阅读 · 0 评论 -
SPOJ DQUERY 求区间内不同数的个数 (主席树)
DQUERY - D-queryGiven a sequence of n numbers a1, a2, …, an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, j), you have to return the number of distinct ele原创 2017-07-26 21:58:51 · 581 阅读 · 0 评论 -
hdu 3911 Black And White (线段树)
Problem DescriptionThere are a bunch of stones on the beach; Stone color is white or black. Little Sheep has a magic brush, she can change the color of a continuous stone, black to white, white to blac原创 2017-07-19 21:25:42 · 343 阅读 · 0 评论 -
poj 2299 Ultra-QuickSort (树状数组)
DescriptionIn 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 i原创 2017-07-21 21:37:51 · 209 阅读 · 0 评论 -
hdu 1556 Color the ball (树状数组)
Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3….N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽”牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?Input每个测试实例第一行为一个整数N,(N <= 100000).接下来的N行,每行原创 2017-07-21 21:13:59 · 375 阅读 · 0 评论 -
bzoj 1036 [ZJOI2008]树的统计Count (树链剖分 + 线段树)
Description 一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成 一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 I II. QSUM u v: 询问从点u到点v的路径上的节点的权值和 注意:从点u到点v的路径上的节点包括u和v本身Input 输原创 2017-07-21 19:46:49 · 250 阅读 · 0 评论 -
bzoj 2243 [SDOI2011]染色 (线段树 + 树链剖分)
Description给定一棵有n个节点的无根树和m个操作,操作有2类: 1、将节点a到节点b路径上所有点都染成颜色c; 2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“112221”由3段组成:“11”、“222”和“1”。 请你写一个程序依次完成这m个操作。Input第一行包含2个整数n和m,分别表示节点数和操作数; 第二行包含n个正整数表示n个节点的初始颜色原创 2017-07-30 09:03:21 · 282 阅读 · 0 评论 -
bzoj1067 [SCOI2007]降雨量 (线段树)
Description我们常常会说这样的话:“X年是自Y年以来降雨量最多的”。它的含义是X年的降雨量不超过Y年,且对于任意Y<Z<X,Z年的降雨量严格小于X年。例如2002,2003,2004和2005年的降雨量分别为4920,5901,2832和3890,则可以说“2005年是自2003年以来最多的”,但不能说“2005年是自2002年以来最多的”由于有些年份的降雨量未知,有的说法是可能正确也可以原创 2017-07-20 21:10:13 · 328 阅读 · 0 评论 -
bzoj 3038 上帝造题的七分钟2 (线段树)
DescriptionXLk觉得《上帝造题的七分钟》不太过瘾,于是有了第二部。 “第一分钟,X说,要有数列,于是便给定了一个正整数数列。 第二分钟,L说,要能修改,于是便有了对一段数中每个数都开平方(下取整)的操作。 第三分钟,k说,要能查询,于是便有了求一段数的和的操作。 第四分钟,彩虹喵说,要是noip难度,于是便有了数据范围。 第五分钟,诗人说,要有韵律,于是便有了时间限制原创 2017-07-20 11:33:19 · 229 阅读 · 0 评论 -
bzoj 1798 维护序列 seq (线段树)
Description老师交给小可可一个维护数列的任务,现在小可可希望你来帮他完成。 有长为N的数列,不妨设为a1,a2,…,aN 。有如下三种操作形式: (1)把数列中的一段数全部乘一个值; (2)把数列中的一段数全部加一个值; (3)询问数列中的一段数的和,由于答案可能很大,你只需输出这个数模P的值。 Input第一行两个整数N和P(1≤P≤1000000000)。第二行含有N个非负整数,从左到原创 2017-07-20 10:07:49 · 194 阅读 · 0 评论 -
poj 1208 The Blocks Problem (链表模拟)
DescriptionMany areas of Computer Science use simple, abstract domains for both analytical and empirical studies. For example, an early AI study of planning and robotics (STRIPS) used a block world in原创 2017-07-14 21:40:17 · 592 阅读 · 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 < j and ai > aj.For a given sequence of numbers a1, a2, …, an, if we move原创 2017-07-29 08:57:38 · 213 阅读 · 0 评论