
线段树
文章平均质量分 54
Davenny
O ever youthful,O ever weeping.
展开
-
hdu 4366
http://acm.hdu.edu.cn/showproblem.php?pid=4366 SuccessorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 4340 Accepted S原创 2017-07-15 16:45:45 · 423 阅读 · 0 评论 -
***hdu6183
Do you like painting? Little D doesn’t like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy painting, Little D asks you to write a program to mai转载 2017-09-06 15:06:21 · 597 阅读 · 0 评论 -
zoj3525扫描线
题目大意: 给你一个长方体,让你求这个长方体可以圈住的点的最小权值和; 思路: 首先枚举x坐标,找出区间长度不超过la的区间; 然后限定y坐标,当其区间长度在所给范围内则加上相应数值,若超过了则减去相应数值。 最后限定z坐标,使得更新的区间长度恰好等于所给的范围;#include<bits/stdc++.h>#define lson l,m,rt<<1#define rson m+1,原创 2017-08-14 18:58:55 · 328 阅读 · 0 评论 -
hdu 6155 - Subsequence Count 线段树+dp+矩阵
参考的原博客:http://www.cnblogs.com/iRedBean/p/7398272.html #include <bits/stdc++.h>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using namespace std;int n,q;const int maxn=1e5+9;const long long mod转载 2017-08-21 11:40:21 · 460 阅读 · 0 评论 -
hdu6070 Dirt Ratio
n ACM/ICPC contest, the ”Dirt Ratio” of a team is calculated in the following way. First let’s ignore all the problems the team didn’t pass, assume the team passed X problems during the contest, and su转载 2017-08-03 21:07:16 · 1406 阅读 · 2 评论 -
BZOJ2243
给定一棵有n个节点的无根树和m个操作,操作有2类: 1、将节点a到节点b路径上所有点都染成颜色c; 2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“ 112221 ” 由3段组成:“ 11 ” 、“ 222 ” 和“ 1 ” 。 请你写一个程序依次完成这m个操作。 Input 第一行包含2个整数n和m,分别表示节点数和操作数; 第二行包含n个正整数表示n个节点原创 2017-08-16 20:35:47 · 556 阅读 · 0 评论 -
poj2750
The little cat takes over the management of a new park. There is a large circular statue in the center of the park, surrounded by N pots of flowers. Each potted flower will be assigned to an integer nu原创 2017-07-24 19:48:26 · 522 阅读 · 0 评论 -
线段树
【完全版】线段树(转载) 转载自:http://www.notonlysuccess.com/膜拜之。。。【完全版】线段树 很早前写的那篇线段树专辑至今一直是本博客阅读点击量最大的一片文章,当时觉得挺自豪的,还去pku打广告,但是现在我自己都不太好意思去看那篇文章了,觉得当时的代码风格实在是太丑了,很多线段树的初学者可能就是看着这篇文章来练习的,如果不小心被我培养出了这么糟糕的风格,实在是过意不转载 2016-07-23 19:37:38 · 314 阅读 · 0 评论 -
hdu4417:线段树单点更新区间求和,离线 Super Mario
Description Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We regard原创 2016-08-07 19:14:53 · 529 阅读 · 5 评论 -
(磨人的小妖精)hdu 1542 Atlantis:线段树扫描线,离散化
http://acm.hdu.edu.cn/showproblem.php?pid=1542DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts o原创 2016-07-24 21:40:45 · 388 阅读 · 0 评论 -
线段树,区间更新,位运算: poj2777Count Color
Description 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 centi原创 2016-07-24 12:52:39 · 484 阅读 · 0 评论 -
线段树:周长并:hdu1828 Picture
http://acm.hust.edu.cn/vjudge/contest/121640#problem/RDescription A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical o原创 2016-07-27 15:36:29 · 338 阅读 · 0 评论 -
线段树+离散化+离线:HDU 4325
Description As is known to all, the blooming time and duration varies between different kinds of flowers. Now there is a garden planted full of flowers. The gardener wants to know how many flowers wil原创 2016-08-04 18:49:12 · 308 阅读 · 0 评论 -
hdu4288:线段树+离散化+子树:Coder
Description In mathematics and computer science, an algorithm describes a set of procedures or instructions that define a procedure. The term has become increasing popular since the advent of cheap原创 2016-08-07 15:36:06 · 342 阅读 · 0 评论 -
poj2828
题目大意: 告诉你有n个人,然后告诉你每个人的插队位置以及自身的值。让你按照最后的队伍顺序输出每个人的值;思路: 由于先插入的人的位置可能会被后插入的人改变,因此后插入的人的优先级会更高,因此我们采用倒插法。最后插入的人的位置肯定不会变。 用线段树维护每个区间中空的位置个数,当插入一个人后就把这个位置丢掉。 想一想为什么维护每个区间空的位置个数就是对的呢?对于一个中间插入的数,其后面插入的那原创 2017-07-24 10:01:29 · 285 阅读 · 0 评论 -
hdu1524线段树,扫描线
http://acm.hdu.edu.cn/showproblem.php?pid=1542题意: 一些相互可能重叠的矩形,让你求他们实际覆盖的面积之和; 对于每个矩形,给你左上角坐标,以及右下角顶点坐标#include <cstdio>#include <cstring>#include <algorithm>#include <iostream>using namespace std转载 2017-07-17 20:46:31 · 392 阅读 · 0 评论 -
poj2892,线段树单点更新,区间合并
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 th原创 2017-07-17 10:07:22 · 333 阅读 · 0 评论 -
zoj3800线段树+离线
You are given a sequence {A0, A1, …, AN-1} and an integer set called GS. Defined a function called G(L, R) on A, where G(L, R) = GCD(Ai) (L ≤ i < R) that is the greatest common divisor of all the integ转载 2017-09-03 08:27:44 · 435 阅读 · 0 评论