
ACM-数据结构-树状数组与线段树
GDUFE_SSS
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU 1892 See you~ (二维树状数组)
二维树状数组练习题: 注意题目给的坐标范围包含0,但树状数组下标从1开始,因此将输入坐标+1计算(否则TLE) AC代码: #include #include #include #include using namespace std; const int maxn=1000+50; const int INF=0x3f3f3f3f; int bit[maxn][maxn原创 2017-07-31 10:16:18 · 399 阅读 · 0 评论 -
HDU 1754 I Hate It(线段树区间求最值)
线段树区间更新求最值裸题 AC代码: #include #include #include #include using namespace std; #define ll long long #define FOR( i , a , b ) for ( int i = a ; i <= b ; ++ i ) #define MOD 10009 #define bug(x) c原创 2017-07-31 09:39:54 · 374 阅读 · 0 评论 -
HDU1556:Color the ball(线段树区间更新单点求值)&&树状数组解法
N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a Input每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。 Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。 直接贴上代码: 直接利用求和函数求单点的值,区间更新只更新起点(i),在(j+1)处设置一个标记表示更新转载 2017-07-31 09:23:34 · 400 阅读 · 0 评论 -
POJ 3468 A Simple Problem with Integers
传送门: http://poj.org/problem?id=3468 题意;给出一个数列,两种操作,Q为查询区间总和,C为区间更新 思路:线段树区间更新区间和值查询 AC代码: #include #include #include #define LL long long using namespace std; const int MAXN=100000; in原创 2017-08-04 09:37:18 · 254 阅读 · 0 评论 -
HDU 1698 Just a Hook 线段树区间改值
Just a Hook Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 36610 Accepted Submission(s): 17861 Problem Description In the game of D原创 2017-12-09 10:34:45 · 328 阅读 · 0 评论