![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树&树状数组
文章平均质量分 80
老焦哥
这个作者很懒,什么都没留下…
展开
-
CodeForce 652D Nested Segments 树状数组
D. Nested Segmentstime limit pertest2 secondsmemory limit pertest256 megabytesinputstandard inputoutputstandard outputYou are given n segments on aline. There are no ends of some seg原创 2016-04-20 20:24:35 · 294 阅读 · 0 评论 -
SPOJ - GSS4 Can you answer these queries IV
这种题做的多了,套路一下就好,只是。。。#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define LL long long#define lson l,m,rt<<1#de原创 2017-05-08 20:36:32 · 284 阅读 · 0 评论 -
UESTC - 482 Charitable Exchange(线段树)
题意:一开始明星有一块钱,他把一块钱拿去换其他价值的东西使得最后价值大于M并时间最短,无解输出-1.思路:按照需求R升序排序,并且按照可达价值作为下标,所用时间作为值进行线段树建树。#include #include #include #include #include #include #include #include #include #include #incl原创 2017-04-12 14:23:24 · 290 阅读 · 0 评论 -
hdu 5700 区间交(线段树)
好久没做这种题都不太会了。想法是先排序然后就大概有个方向了。#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define LL long long#define lson l,m原创 2017-04-01 20:27:51 · 250 阅读 · 0 评论 -
zoj 3686 - A Simple Tree Problem (dfs序+线段树区间更新)
Given a rooted tree, each node has a boolean (0 or 1) labeled on it. Initially, all the labels are 0.We define this kind of operation: given a subtree, negate all its labels.And we want to query t原创 2017-03-20 18:30:53 · 238 阅读 · 0 评论 -
poj 2155 - Matrix(二维树状数组)
MatrixTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 25606 Accepted: 9478DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j]原创 2016-12-23 21:48:47 · 216 阅读 · 0 评论 -
HDU 5634-Rikka with Phi(线段树区间更新)
Rikka with PhiTime Limit: 16000/8000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 312 Accepted Submission(s): 103Problem DescriptionRikka and原创 2016-09-26 22:59:32 · 304 阅读 · 0 评论 -
UESTC 94 - Bracket Sequence(线段树+区间合并)
DescriptionThere is a sequence of brackets, which supports two kinds of operations.we can choose a interval $[l,r]$, and set all the elements range in this interval to left bracket or right br转载 2016-07-22 11:26:50 · 342 阅读 · 0 评论 -
POJ 3667 - Hotel(线段树+区间合并)
DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent,原创 2016-07-22 11:23:30 · 222 阅读 · 0 评论 -
poj 2528 - Mayor's posters(线段树+离散化)
The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally d原创 2016-07-19 20:22:35 · 194 阅读 · 0 评论 -
三篇线段树扫描线总结
HDU 1542 Atlantis,裸面积并#include #include #include using namespace std;const int maxn = 200;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1struct seg{ double l, r, h; int s; seg(){} seg(原创 2016-07-29 14:17:59 · 332 阅读 · 0 评论 -
hdu 1698 - Just a Hook(线段树区间更新)
DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same lengt原创 2016-07-19 13:14:01 · 220 阅读 · 0 评论 -
poj 2886-Who Gets the Most Candies?(线段树)
DescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero integer on it in his/her hand. The原创 2016-07-19 11:41:02 · 227 阅读 · 0 评论 -
poj 2828--Buy Tickets(线段树)
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Ca原创 2016-07-18 17:42:26 · 269 阅读 · 0 评论 -
HDU 1394 Minimum Inversion Number (线段树)
Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17077 Accepted Submission(s): 10370Problem Description原创 2016-07-14 22:37:36 · 171 阅读 · 0 评论 -
HDU 3397 - Sequence operation(线段树+区间合并)
Descriptionlxhgww got a sequence contains n characters which are all '0's or '1's. We have five operations here: Change operations: 0 a b change all characters into '0's in [a , b] 1 a b c原创 2016-07-23 13:04:46 · 231 阅读 · 0 评论 -
HDU 3308 - LCIS(线段树+区间合并)
DescriptionGiven n integers. You have two operations: U A B: replace the Ath number by B. (index counting from 0) Q A B: output the length of the longest consecutive increasing subsequence (原创 2016-07-22 19:23:20 · 268 阅读 · 0 评论 -
POJ 3225 - Help with Intervals(线段树)
DescriptionLogLoader, Inc. is a company specialized in providing products for analyzing logs. While Ikki is working on graduation design, he is also engaged in an internship at LogLoader. Amon原创 2016-07-22 12:28:04 · 281 阅读 · 0 评论 -
hihocoder-1116 : 计算 (线段树区间合并)
描述现在有一个有n个元素的数组a1, a2, ..., an。记f(i, j) = ai * ai+1 * ... * aj。初始时,a1 = a2 = ... = an = 0,每次我会修改一个ai的值,你需要实时反馈给我 ∑1 f(i, j)的值 mod 10007。输入第一行包含两个数n(1接下来q行,每行包含两个数i, x,代表我把ai的值改为了原创 2017-09-30 10:24:28 · 229 阅读 · 0 评论