
线段树
文章平均质量分 88
Uniontake
这个作者很懒,什么都没留下…
展开
-
HDU - 1698 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 length.Now ...原创 2018-05-17 19:06:58 · 167 阅读 · 0 评论 -
HDU - 1540 I - Tunnel Warfare 线段树 + (二分 or 区间合并)
Tunnel WarfareTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11472 Accepted Submission(s): 4494Problem DescriptionDuring the War of Resistan...原创 2018-05-29 19:35:31 · 193 阅读 · 0 评论 -
HDU - 3974 J - Assign the task dfs序+线段树
Assign the taskTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4617 Accepted Submission(s): 1854Problem DescriptionThere is a company that h...原创 2018-05-29 21:34:42 · 227 阅读 · 0 评论 -
HDU - 4614 L - Vases and Flowers 线段树 + 二分
Vases and FlowersTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 4375 Accepted Submission(s): 1797Problem Description Alice is so popular th...原创 2018-05-30 10:27:59 · 243 阅读 · 0 评论 -
POJ - 3667 Hotel 线段树区间合并
HotelTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 19431 Accepted: 8455DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on...原创 2018-05-30 17:33:41 · 285 阅读 · 0 评论 -
HDU - 4553 M - 约会安排 线段树+区间合并
约会安排Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2457 Accepted Submission(s): 677Problem Description 寒假来了,又到了小明和女神们约会的季节。 小明虽为屌丝级码农,但非常活...原创 2018-05-30 22:07:26 · 278 阅读 · 0 评论 -
HDU - 5023 A Corrupt Mayor's Performance Art 线段树 按位记录颜色
A Corrupt Mayor's Performance ArtTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 100000/100000 K (Java/Others)Total Submission(s): 2984 Accepted Submission(s): 1070Problem DescriptionCorrup...原创 2018-06-01 21:02:30 · 164 阅读 · 0 评论 -
[HDU多校02] HDU 6315 Naive Operations 线段树
Naive OperationsTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 502768/502768 K (Java/Others)Total Submission(s): 1720 Accepted Submission(s): 738 Problem DescriptionIn a galaxy far...原创 2018-07-26 21:04:23 · 153 阅读 · 0 评论 -
[Wannafly挑战赛22] D 整数序列 线段树
题目描述 给出一个长度为n的整数序列a1,a2,...,an,进行m次操作,操作分为两类。操作1:给出l,r,v,将al,al+1,...,ar分别加上v;操作2:给出l,r,询问输入描述:第一行一个整数n接下来一行n个整数表示a1,a2,...,an接下来一行一个整数m接下来m行,每行表示一个操作,操作1表示为1 l r v,操作2表示为2 l r保证1≤n,m,ai,...原创 2018-08-18 13:40:00 · 306 阅读 · 0 评论 -
HDU - 2430 Beans 线段树|单调队列
Description题意给出n个谷堆,每个谷堆有wi个谷子题意给出n个谷堆,每个谷堆有wi个谷子题意给出n个谷堆,每个谷堆有w_i个谷子 现在要在n个谷堆中找出一个连续的区间[i,j]使得区间的和sumij现在要在n个谷堆中找出一个连续的区间[i,j]使得区间的和sumij现在要在n个谷堆中找出一个连续的区间\begin{bmatrix}i,j\end{bmatrix}使得区间的和sum_...原创 2018-08-28 16:22:22 · 337 阅读 · 1 评论 -
POJ - 2528 D - Mayor's posters 区间覆盖+区间不同颜色个数+离散化
Mayor's postersTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 73819 Accepted: 21286 DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in ...原创 2018-05-16 21:26:58 · 202 阅读 · 0 评论 -
POJ - 3468 C - A Simple Problem with Integers 区间增加+区间查询
A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 130688 Accepted: 40570Case Time Limit: 2000MSDescriptionYou have N integers, A1, A2, ... , AN. You need to deal...原创 2018-05-16 20:44:19 · 148 阅读 · 0 评论 -
ZOJ - 1610 F - Count the Colors 线段染色 间断计数
Count the ColorsTime Limit: 2 Seconds Memory Limit: 65536 KBPainting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is coun...原创 2018-05-17 19:28:45 · 161 阅读 · 0 评论 -
POJ - 3264 G - Balanced Lineup 区间最值
Balanced LineupTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 60899 Accepted: 28494Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line...原创 2018-05-17 20:00:23 · 214 阅读 · 0 评论 -
HDU - 4027 H - Can you answer these queries? 区间开方更新+暴力
Can you answer these queries?Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 21998 Accepted Submission(s): 5215Problem DescriptionA lot of ba...原创 2018-05-17 21:48:16 · 246 阅读 · 0 评论 -
codeforces 895E Eyes Closed 线段树 期望 数学
留坑!原创 2018-05-18 13:28:41 · 202 阅读 · 0 评论 -
[模板]线段树SegTree
增加实现功能-单点增加+区间增加+区间查询struct SegTree{ ll Sum[maxn<<2],Max[maxn<<2],cnt[maxn<<2],lz[maxn<<2]; void init() { memset(Sum,0,sizeof(Sum)); memset(Max,0,s...原创 2018-05-15 15:26:32 · 259 阅读 · 0 评论 -
HDU - 1166 A - 敌兵布阵 单点更新+区间查询
题意:如题线段树#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 1e5+10;ll arr[maxn];char str[maxn];/// Pushup 函数更新节点信息,这里是求和struct SegTree{ ll sum[maxn<&l...原创 2018-05-15 16:33:05 · 148 阅读 · 0 评论 -
HDU - 1754 B - I Hate It - 线段树 单点覆盖+区间查询
代码:#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 2e5+10;ll arr[maxn];struct SegTree{ ll Max[maxn<<2],cnt[maxn<<2],lz[maxn<<2]; ...原创 2018-05-15 16:48:08 · 279 阅读 · 0 评论 -
Wannafly挑战赛15 D 数字串 区间逆序对
题目描述 一个只含数字的字符串,q次操作,每次操作将第i位数字改为x,每次操作后,统计长度在[l, r]之间且首数字大于尾数字的子串的个数。输入描述:第一行一个只含数字的字符串;第二行3个整数q, l, r;接下来q行,每行两个整数i, x。输出描述:输出q行,每行一个整数,表示长度在[l, r]之间且首数字大于尾数字的子串的个数。示例1输入5856052 2 41 64 2输出78备...原创 2018-05-16 13:16:58 · 406 阅读 · 0 评论 -
中南林业大学11th J 线段树
题目描述 一个长度为n的数组a,数组下标从0开始。现在要求你查询从左到右第一个不小于k的数字a[i], 输出i,并且马上把a[i-1]++;如果你找到的a[i]中的i等于0,那么a[0-1]是非法的,因此只要输出i就行了,不进行a[i-1]++;如果你在数组中找不到一个数字不小于k,则输出”are you ok ”输入描述:多组输入,输入直到遇到EOF为止;第一行输入两个整数n和q,表示数组a...原创 2018-05-22 22:25:31 · 177 阅读 · 0 评论 -
CodeForces - 91B Queue 单调队列 | 线段树
题目给出n个数的序列,求出每一个数右边最后一个比他小的数的位置差。题解考虑单调队列做法维护一个单调递减的队列。对于一个数来说 最优被定义为 尽可能小,同时位置要小。于是对于一个新入队的数来说,如果他比最小的数大的话。其位置也大于最小的数。则这个数是无用的。于是对于每个新入队的数,在入队前在单调队列中二分查找一下最后一个比他的小的数的位置。如果满足单调性则入队...原创 2018-08-24 19:33:01 · 529 阅读 · 0 评论