![](https://img-blog.csdnimg.cn/20190918140129601.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
线段树
线段树
Charon_HN
NLP炼丹儿
展开
-
poj -3468 + HDU - 1698 线段树区间修改,区间查询
https://cn.vjudge.net/problem/POJ-3468 https://cn.vjudge.net/problem/HDU-1698两者只有一个地方是不太一样的,就是他们需要处理的方式POJ的是给你一个区间,让你加减一个数,从而改变区间的值,HDU是让你修改区间的值,而不是进行累加和累减的操作先上POJ的#include <iostr...原创 2018-08-15 11:14:29 · 856 阅读 · 0 评论 -
HDU 1542+HDU 1255(进阶) 线段树扫描线法解决矩形覆盖求面积
There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe diff...原创 2018-12-05 09:36:14 · 344 阅读 · 1 评论 -
HDU 4614 二分区间端点实现线段树区间查询
Vases and Flowers Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one f...原创 2018-12-01 19:06:27 · 162 阅读 · 0 评论 -
HDU 4553 线段树 连续区间和问题
HDU1540题目大意:查找是否有连续的空余时间他的操作有三个 :ds x 查找屌丝的时间有连续的x长度的空余时间ns x 为女神安排时间,先查找屌丝时间是否有空余,没有的话无视屌丝,直接判断女神时间是否有连续x长的空余时间stduy a b 清空a到b区间的事情#include <iostream>#include <cstdio>#inc...原创 2018-12-03 15:58:14 · 122 阅读 · 0 评论 -
ZCMU 1985:小C的数学问题(线段树+分治)或者 栈的实现
Problem Description小C是个云南中医学院的大一新生,在某个星期二,他的高数老师扔给了他一个问题。让他在1天的时间内给出答案。但是小C不会这问题,现在他来请教你。请你帮他解决这个问题。有n个数,每个数有权值。数学老师定义了区间价值为区间和乘上区间内的最小值。现在要你找出有最大区间价值的区间是什么,并输出区间价值。Input每个输入文件只包含单组数据。...原创 2019-04-04 22:13:20 · 182 阅读 · 0 评论 -
Ground Defense (线段树维护差分数组)
下面是几组数据原创 2019-04-11 21:52:25 · 254 阅读 · 0 评论 -
UPC 补题 5052 Master of GCD
题目描述Hakase has n numbers in a line. At fi rst, they are all equal to 1. Besides, Hakase is interested in primes. She will choose a continuous subsequence [l, r] and a prime parameter x each time and...原创 2019-04-09 16:58:53 · 138 阅读 · 0 评论 -
HDU - 6601 2019 Multi-University Training Contest 2(关于斐波那契有趣的性质)
Keen On Everything But Trianglesimple input5 32 5 6 5 21 32 42 5simple output131616题目大意:N个数,这些数是三角形的边长,Q次查询,每次查询一个区间,问查询的区间里面构成最大三角形的周长是多少,如果区间里面的边不能构成三角形,那就输出-1分析:1e5次的查询,大家可能会想到线段树的...原创 2019-07-24 22:18:43 · 104 阅读 · 0 评论 -
2019HDU多校第四场—— HDU 6621
K-th Closest DistanceYou have an array: a1, a2, , an and you must answer for some queries.For each query, you are given an interval [L, R] and two numbers p and K. Your goal is to find the Kth clos...原创 2019-08-04 09:49:58 · 295 阅读 · 0 评论 -
HDU 1540 线段树单点查询+dfs建立区间大小(时间戳)+分析为什么查询左子树
During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except t...原创 2018-11-26 17:49:54 · 106 阅读 · 0 评论 -
HDU 1540 线段树求最大连续区间和问题
Tunnel Warfare During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay ...原创 2018-11-26 11:41:29 · 309 阅读 · 0 评论 -
POJ 2777 线段树 区间维护 二进制储存
Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem. There is a very long board with length L centimeter, L is...原创 2018-08-16 10:00:17 · 512 阅读 · 0 评论 -
HDU-1394 逆序数求解 树状数组/线段树 求逆序数 +递推
The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai > aj. For a given sequence of numbers a1, a2, ..., an, if we move the f...原创 2018-08-16 21:42:31 · 235 阅读 · 0 评论 -
HDU-2795 线段树
Billboard At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcements are poste...原创 2018-08-17 15:27:32 · 127 阅读 · 0 评论 -
ZOJ 1610 非点的区间修改及输出修改元素段 线段树+暴力查询
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last. ...原创 2018-08-17 17:42:42 · 258 阅读 · 0 评论 -
POJ 2528 模拟实现线段树+离散化+数据问题
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...原创 2018-09-25 09:45:09 · 201 阅读 · 0 评论 -
LA 3938 线段树 动态最大连续和
Ray, Pass me the dishes!After doing Ray a great favor to collect sticks for Ray, Poor Neal becomes very hungry. In return for Neal's help, Ray makes a great dinner for Neal. When it is time for dinn...原创 2018-11-22 13:43:31 · 291 阅读 · 0 评论 -
LA4108 线段树 区间覆盖
题目 SKYLINE 题意:我们要在地平线(看成数轴)上依次建造n座建筑物。建筑物的修建按照从后往前的顺序,因此新建筑物可能会挡住一部分老建筑物。修建完一座建筑物后,统计它在多长的部分最长(可以和其他建筑物并列最高),并把这个长度称为“覆盖度”。求所有建筑物的总覆盖度分析:维护一个区间的最大值还有最小值,如果在当前的区间的最小值还是大于当前的所要盖的楼房的高度的时候就...原创 2018-11-24 17:44:31 · 258 阅读 · 0 评论 -
UVA 11992 线段树将矩阵转化为一维数组
UVA11992 区间求和,最大值,最小值题意:r行c列的全0矩阵 有三种操作 1 x1 y1 x2 y2 v子矩阵(x1,y1,x2,y2)所有元素增加v 2 x1 y1 x2 y2 v子矩阵(x1,y1,x2,y2)所有元素设为v 3 x1 y1 x2 y2 查询子矩阵元素的和、最小值、最大值题解:由于r<...原创 2018-11-23 12:59:51 · 179 阅读 · 0 评论 -
XKC's basketball team 2019徐州站网络赛 E
XKC’s basketball teamXKC , the captain of the basketball team , is directing a train of nn team members. He makes all members stand in a row , and numbers them 1 \cdots n1⋯n from left to right.The a...原创 2019-09-12 14:07:24 · 337 阅读 · 0 评论