
线段树
文章平均质量分 81
fyfcauc
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj-2777
// 3756K 719MS G++ #include #include #include using namespace std;struct TreeNode { // 0: no color, >= 1, whole cover by one color, -1: one color // , but not whole covered, -2: >原创 2014-07-31 18:01:25 · 542 阅读 · 0 评论 -
poj-3225
#include #include #define MAX 65536struct TreeNode { int left; int right; int color; //0: all no choosed 1: all choosed, -1: combined int leftFlag; //0: [ , 1: ( int rightFlag; //0: [ , 1:原创 2014-08-13 22:50:03 · 422 阅读 · 0 评论 -
【完全版】线段树
From: http://www.notonlysuccess.com/index.php/segment-tree-complete/很早前写的那篇线段树专辑至今一直是本博客阅读点击量最大的一片文章,当时觉得挺自豪的,还去pku打广告,但是现在我自己都不太好意思去看那篇文章了,觉得当时的代码风格实在是太丑了,很多线段树的初学者可能就是看着这篇文章来练习的,如果不小心被我培养出了这么糟糕的转载 2014-08-13 20:50:46 · 628 阅读 · 0 评论 -
poj-3264
// 2404K 3688MS G++#include #include const int MAX = 50010;struct TreeNode { int left; int right; int Max; int Min;};typedef struct TreeNode TreeNode;TreeNode tree[MAX<<原创 2014-08-26 17:31:51 · 534 阅读 · 0 评论 -
poj-3468
// 6884K 2032MS G++#include "cstdio"#include "cstring"#include "iostream"using namespace std;#define MAX 100010struct TreeNode { long left; long right; long long sum; long原创 2014-08-13 11:59:56 · 466 阅读 · 0 评论 -
一步一步理解线段树
From: http://www.cnblogs.com/TenosDoIt/p/3453089.html#b--------------------------一 概述线段树,类似区间树,是一个完全二叉树,它在各个节点保存一条线段(数组中的一段子数组),主要用于高效解决连续区间的动态查询问题,由于二叉结构的特性,它基本能保持每个操作的复杂度为O(logn)。线段树的每个节点表转载 2014-08-11 12:01:00 · 433 阅读 · 0 评论 -
poj-2823
// 24976K 6125MS C++#include #include using namespace std;#define K_MAX 1000010#define INF 99999999struct TreeNode { int left; int right; int max; int min;};typedef str原创 2014-08-10 11:34:47 · 543 阅读 · 0 评论 -
poj-2991
#include #include #include const int MAX = 10010;struct TreeNode { int left; int right; // double X; // double Y; double length; // double Height; int angel; int lazyRotation;};typede原创 2014-08-17 21:14:01 · 711 阅读 · 0 评论 -
poj-2750
#include #include #define MAX 100010int flowers[MAX];using namespace std;int flowerNum;inline int max(int a, int b) { return a >= b ? a: b;}inline int min(int a, int b) { return原创 2014-08-06 15:35:37 · 525 阅读 · 0 评论 -
poj-2828
// 14460K 3766MS G++#include #include #define MAX 200100struct TreeNode { int val; int l; int r; int insertPosNum;};typedef struct TreeNode TreeNode;TreeNode tree[MAX*4];原创 2014-07-31 15:00:31 · 489 阅读 · 0 评论 -
poj-2528
// 20884K 297MS G++#include #include #include int posterNum;int ep[20010];unsigned short dis[10000010];int epNum;int cmp(const void * p1, const void * p2) { return (*((int*)p1)) - (原创 2014-07-29 17:13:37 · 552 阅读 · 0 评论 -
poj-2352
// 668K 422MS G++#include #include const int MAX = 32767;const int LEVEL_MAX = 15100;int tree[MAX<<1];int levelNum[LEVEL_MAX];int starNum;void update(int curId, int x, int begin, int en原创 2014-07-28 15:36:19 · 470 阅读 · 0 评论 -
poj-2886
// 26584K 1407MS G++#include #include #include using namespace std;#define MAX 500050struct ChildeTreeNode { int childId; int childNum; int left; int right;};typedef str原创 2014-08-01 12:13:27 · 734 阅读 · 0 评论 -
poj-1436
// 2240K 1297MS C++#include #include #include #include #include using namespace std;const int MAX = 8010 * 2;set lineVisibleInfo[8000];struct TreeNode { int left; int right; int lineId原创 2014-08-17 13:07:06 · 503 阅读 · 0 评论