数据结构
文章平均质量分 73
ChasingWaves
这个作者很懒,什么都没留下…
展开
-
POJ 3253 Fence Repair 霍夫曼树 贪心 优先队列
非常经典的一道原创 2014-07-18 16:15:07 · 501 阅读 · 0 评论 -
hdu 1698 Just a Hook 线段树的区间置数
//781MS 2388K#include #include #include #include #define lch(x) ((x)<<1)#define rch(x) ((x)<<1|1)using namespace std;typedef long long LL;const int MAX_N = int(1e5);int sum[MAX_N<<2], tag[原创 2014-08-14 18:32:11 · 306 阅读 · 0 评论 -
POJ 3468
//5580K 2516MS#include #include #include #include #define lch(x) ((x)<<1)#define rch(x) ((x)<<1 | 1)using namespace std;typedef long long LL;const int MAX_N = 100000;LL a[MAX_N+5];LL del[原创 2014-08-13 20:37:10 · 361 阅读 · 0 评论 -
hdu 4941 Magical Forest 多校第七场
用map保存行和列交换后的序号,纯模拟就可以了原创 2014-08-12 17:20:14 · 353 阅读 · 0 评论 -
hdu 2795 Billboard 线段树单点更新(线段树+二分)
机房网络好了,现在把博文补上原创 2014-08-13 15:15:51 · 348 阅读 · 0 评论 -
POJ 2528 Mayor's posters 线段树的区间覆盖 离散化
//1472K 63MS#include #include #include #include #define lch(n) ((n)<<1)#define rch(n) ((n)<<1|1)using namespace std;const int MAX_N = int(1e4);bool vis[MAX_N+5];int li[MAX_N+5], ri[MAX_N+5原创 2014-08-16 11:36:33 · 539 阅读 · 0 评论 -
hdu 1394 Minimum Inversion Number 用线段树求0到n-1的排列的逆序数
把第一个数拿到最后去,逆序数的原创 2014-08-12 11:24:46 · 429 阅读 · 0 评论 -
ZOJ Problem Set - 3768 Continuous Login
Time Limit: 2 Seconds Memory Limit: 131072 KB Special JudgePierre is recently obsessed with an online game. To encourage users to log in, this game will give users a continuous login reward. The m原创 2014-04-07 14:50:04 · 504 阅读 · 0 评论 -
zoj 3772 Calculate the Function 线段树+矩阵
Time Limit: 2 Seconds Memory Limit: 65536 KBYou are given a list of numbers A1 A2 .. AN and M queries. For the i-th query:The query has two parameters Li and Ri.The query will define a funct原创 2014-04-07 18:44:15 · 530 阅读 · 0 评论 -
POJ 3468
//#include #include #include #include #define lch(n) ((n)<<1)#define rch(n) ((n)<<1 | 1)using namespace std;typedef long long LL;const int MAX_N = int(1e5);LL sum[MAX_N<<2], add[MAX_N<<2];原创 2014-08-14 09:29:20 · 342 阅读 · 0 评论 -
hdu 1166 敌兵布阵 线段树单点更新
全部采用扩展区间原创 2014-08-11 15:35:43 · 339 阅读 · 0 评论 -
hdu 1754 I Hate It 线段树单点更新
//1093MS 4492K#include #include #include #include #define lch(x) ((x)<<1)#define rch(x) ((x)<<1 | 1)using namespace std;const int MAX_N = 200000;int tree[MAX_N<<2], a[MAX_N<<1];int N, N2, M原创 2014-08-11 17:26:44 · 403 阅读 · 0 评论 -
POJ 3264(2) Balanced Lineup
这次不用区间扩展了。#include #include #include #include using namespace std;#define lson(x) ((x)<<1)#define rson(x) ((x)<<1 | 1)const int MAXN = 50000;const int INF = INT_MAX;int dat1[MAXN<<2], dat2原创 2014-07-15 17:08:05 · 313 阅读 · 0 评论 -
POJ 3468 A Simple Problem with Integers 线段树成段更新+区间查询
这次不用区间扩展了,那样写会原创 2014-07-15 16:52:41 · 378 阅读 · 0 评论 -
POJ 3264 Balanced Lineup 线段树的构建+区间查询
第一次写线段树,能写出来感觉很开心。。。原创 2014-07-14 15:53:55 · 348 阅读 · 0 评论 -
线段树单点更新和区间查询
这是最基础的一类线段树问题。区间采用左闭右开原创 2014-07-13 10:41:58 · 373 阅读 · 0 评论 -
POJ 3614 Sunscreen 贪心 优先队列
这题的模型是给你一些线段和一些点,每个点的使用次数都是有一定限制的,每条线段只能被标记一次,求最多有多少条线段被标记。将奶牛按照阳光强度的最小值从小到大排序。将防晒霜也按照能固定的阳光强度从小到大排序从最小的防晒霜枚举,将所有符合 最小值小于等于该防晒霜的 奶牛的 最大值 放入优先队列之中。然后优先队列是小值先出所以就可以将这些最大值中的最小的取出来。更新答案。原创 2014-07-19 14:56:55 · 390 阅读 · 0 评论 -
hdu 4902 Nice boat 多校第四场 线段树的区间置数+区间更新
There are n numbers a_1,a_2,...,a_n on a line, everytime you can change every number in a segment [l,r] into a number x(type 1), or change every number a_i in a segment [l,r] which is bigger than x to原创 2014-08-01 12:58:29 · 387 阅读 · 0 评论 -
hdu 4902 Nice boat(第二篇) 带push_up操作
//906MS 1972K#include #include #include #include #define lch(x) ((x)<<1)#define rch(x) ((x)<<1 | 1)using namespace std;const int maxn = 100000;int num[maxn+5];int tree[maxn<<2];bool flag[m原创 2014-08-01 14:27:09 · 338 阅读 · 0 评论 -
hdu 4893 Wow! Such Sequence! 线段树单点更新+区间更新+区间查询
//1312MS 4668K#include #include #include #include using namespace std;typedef long long ll;const int M=90;const int N=100005;ll f[100],sum[N<<2],need[N<<2];bool lazy[N<<2];inline ll Find(原创 2014-07-30 13:33:02 · 416 阅读 · 0 评论 -
hdu 5023 A Corrupt Mayor's Performance Art 广州网络赛 线段树的区间覆盖+种类查询
Problem DescriptionThe wall was divided into N segments and the width of each segment was one cun(cun is a Chinese length unit). All segments were numbered from 1 to N, from left to right. There w原创 2014-09-24 10:57:27 · 416 阅读 · 0 评论