线段树
文章平均质量分 80
mumei314
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Codeforces Round #693 (Div. 3)ABCDE——解题报告
比赛链接:https://codeforces.com/contest/1472A-Cards for Friends题解按照题意直接模拟就行,答案就是能 (被w乘除的最大的2的n次幂) 乘以 (被h乘除的最大的2的n次幂)。判断是否大于等于n就行了。简单做法:巧妙利用二进制运算&处理,答案就是( w&(-w) )*( h&(-h) ),这个运算在树状数组中用的比较多。麻烦做法:直接根据题意模拟即可。代码简单做法if(1ll*(w&..原创 2021-01-23 22:21:00 · 277 阅读 · 0 评论 -
CodeForces1284D New Year and Conference——线段树|ST表+二分
题目链接:https://codeforces.com/contest/1284/problem/D题目大意:有n场表演,有两个场地,如果在a场地表演则需要占用[sai,eai]这段时间,在b场地表演则需要占用 [sbi,ebi] 这段时间。如果两个表演,占用了同一个时间点,则认为这两个表演是冲突的。但因为每个表演在a场地和b场地的时间段不同,有表演可能在一个场地冲突而在另一个不冲突。所...原创 2020-02-12 13:01:12 · 347 阅读 · 0 评论 -
2019年12月河南农业大学邀请赛F题——幂求和
题意给你一个数列a1,a2,a3......an,数列所有值的初始值为0,有三种操作:操作1:将区间[l,r]中所有数加c操作2:将区间[l,r]中所有数变成c操作3:查询区间[l,r]中,的值最终答案对1e4+7取余就行了。题解:这个题有两个做法,一种是明显的用线段树维护就行,另一种就是用珂朵莉树,可以说是板子题了。其实正确做法是用线段树维护,珂朵莉树的做法可以...原创 2019-12-29 00:10:42 · 341 阅读 · 0 评论 -
hdu3642——矩形体积并(覆盖三次以上)
题目链接:https://vjudge.net/problem/HDU-3642DescriptionJack knows that there is a great underground treasury in a secret region. And he has a special device that can be used to detect treasury unde...原创 2019-12-18 19:37:55 · 254 阅读 · 0 评论 -
hdu1255——矩形面积并(两次覆盖以上)
题目链接:https://vjudge.net/problem/HDU-1255Description给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积.Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第一行是一个正整数N(1<=N<=1000),代表矩形的数量,然后是N行数据,每一...原创 2019-12-18 18:34:51 · 705 阅读 · 1 评论 -
hdu4553——线段树区间合并
题目链接:https://vjudge.net/problem/HDU-4553Description 寒假来了,又到了小明和女神们约会的季节。 小明虽为屌丝级码农,但非常活跃,女神们常常在小明网上的大段发言后热情回复“呵呵”,所以,小明的最爱就是和女神们约会。与此同时,也有很多基友找他开黑,由于数量实在过于巨大,怎么安排时间便成了小明的一大心事。 我们已知...原创 2019-12-18 16:20:40 · 235 阅读 · 0 评论 -
hdu4614——线段树+二分
题目链接:https://vjudge.net/problem/HDU-4614#author=2013551629Description Alice有N个花瓶(标号为0~ N-1)。当她收到一些花时,她会随机的选择一个瓶子A,从它开始遍历A,A+1, A+2, ..., N-1号瓶子,遇到空瓶子就放一朵花进去,直到花朵放完或没有瓶子,剩下的花将被丢弃。有...原创 2019-12-18 15:46:45 · 1239 阅读 · 2 评论 -
hdu4578——线段树多种操作
题目链接:https://vjudge.net/problem/HDU-4578#author=hzoi2017_csmDescriptionYuanfang is puzzled with the question below:There are n integers, a 1, a 2, …, a n. The initial values of them are 0. The...原创 2019-12-18 15:14:55 · 469 阅读 · 0 评论 -
hdu3974——dfs序+线段树
题目链接:https://vjudge.net/problem/HDU-3974#author=dawn_LLDescription有一家公司有N个员工(从1到N),公司里每个员工都有一个直接的老板(除了整个公司的领导)。如果你是某人的直接老板,那个人就是你的下属,他的所有下属也都是你的下属。如果你是没有人的老板,那么你就没有下属,没有直接老板的员工就是整个公司的领导,也就是说N个员...原创 2019-12-13 15:42:24 · 476 阅读 · 0 评论 -
HDU1540——线段树维护连续区间
题目链接:https://vjudge.net/problem/HDU-1540#author=cqbzguomaoDescription在抗日战争期间,华北平原广大地区进行了大规模的隧道战。 一般来说,通过隧道连接的村庄排成一列。 除了两端,每个村庄都与两个相邻的村庄直接相连。入侵者经常对一些村庄发动袭击并摧毁其中的部分隧道。 八路军指挥官要求最新的隧道和村庄连接状态。 如果某些...原创 2019-12-12 18:45:34 · 311 阅读 · 0 评论 -
poj3695——静态线段树+矩形面积并
题目链接:http://poj.org/problem?id=3695You are developing a software for painting rectangles on the screen. The software supports drawing several rectangles and filling some of them with a color differe...原创 2019-09-23 16:05:15 · 244 阅读 · 0 评论 -
poj1389——矩形面积并(线段树,离散化,扫描线)
题目链接:http://poj.org/problem?id=1389There are N, 1 <= N <= 1,000 rectangles in the 2-D xy-plane. The four sides of a rectangle are horizontal or vertical line segments. Rectangles are defined b...原创 2019-09-21 13:35:22 · 196 阅读 · 0 评论 -
A - 敌兵布阵 (线段树基础)
#include<iostream>#include<algorithm>#include<cmath>#include<cstring>#include<cstdio>#include<cstdlib>#include<vector>#include<map>#include<...原创 2019-04-29 17:34:27 · 391 阅读 · 0 评论 -
B - I Hate It
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5000...原创 2019-04-29 17:49:51 · 205 阅读 · 0 评论 -
G - Balanced Lineup
For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things ...原创 2019-04-29 17:53:34 · 181 阅读 · 0 评论 -
C - A Simple Problem with Integers
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the ...原创 2019-04-29 19:41:14 · 404 阅读 · 0 评论 -
E - Just a Hook
In 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 lengthNow Pudg...原创 2019-04-30 14:03:06 · 258 阅读 · 0 评论 -
D - Mayor's posters (离散化)
DescriptionThe 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...原创 2019-05-01 21:34:57 · 445 阅读 · 0 评论 -
H - Can you answer these queries?
Can you answer these queries?A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battles...原创 2019-05-01 23:13:11 · 180 阅读 · 0 评论 -
poj1151——矩阵面积并(线段树,离散化,扫描线)
题目链接:http://poj.org/problem?id=1151There 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 un...原创 2019-09-21 13:31:42 · 331 阅读 · 0 评论 -
Count the Colors (线段树染色)
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....原创 2019-04-24 00:06:43 · 542 阅读 · 1 评论
分享