
数据结构-树状数组
___Evan
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU-1556 Color the ball 简单树状数组
#include "stdio.h" #include "string.h" const int maxn = 100005; int n; int c[maxn]; int lowbit( int x ) { return x&(-x); } void add( int x,int ad ) { while( x <= n ) { c[x] += ad;原创 2013-10-26 18:38:44 · 522 阅读 · 0 评论 -
POJ-2892 Tunnel Warfare 树状数组
http://acm.hdu.edu.cn/showproblem.php?pid=1540 题意: 给出直线上一系列的村庄,如果相邻村庄都没有被破坏, 则两村庄是连接的,题目给出一系列的破坏操作,对指定号码的村庄进行破坏, 还有一系列的询问操作,询问与指定号码的村庄直接相连或间接相连的村庄有几个, 还有一个修复操作,是对最后破坏的村庄进行修复。 #include "s原创 2013-10-26 19:25:37 · 582 阅读 · 0 评论 -
HDU-1166 敌兵布阵 简单树状数组
http://acm.hdu.edu.cn/showproblem.php?pid=1166 #include "stdio.h" #include "string.h" const int maxn = 50005; int n,c[maxn]; int lowbit( int x ) { return x&(-x); } void add( int x,int ad原创 2013-10-27 19:54:58 · 635 阅读 · 0 评论 -
POJ-2481 Cows 树状数组
题目链接 给出n个牛的坐标,i牛的坐标为[Si,Ei],j牛的坐标为[Sj,Ej],若SiEj-Sj,则牛i比牛j强壮,现在呀要求出每个牛比它强壮的牛的数量。 #include #include #include #include #include #include #include #include #include using namespace std; const原创 2014-03-28 12:19:18 · 373 阅读 · 0 评论 -
HDU-1394 Minimum Inversion Number 树状数组
题目链接 #include "stdio.h" #include "string.h" const int maxn = 5005; int n; int a[maxn],c[maxn]; int lowbit( int x ) { return x&(-x); } void add( int x ) { while( x<=maxn ) {原创 2014-03-28 14:01:32 · 394 阅读 · 0 评论 -
Poj 3928 Ping pong 树状数组
题目链接 #include #include #include #include #include using namespace std; typedef long long LL; const int maxn = 100005; const int Mod = 1000000007; int n; int c[maxn<<2]; struct Node { int id原创 2014-08-02 19:03:22 · 422 阅读 · 0 评论