线段树
HUGOkungggg
Never go back, where you begun.
展开
-
2020牛客寒假算法基础集训营4
坐火车写得更好的题解:传送门//#include <bits/stdc++.h>#include <algorithm>#include <cstdio>#include <cstdlib>#include <vector>#include <queue>#include <map>#inc...原创 2020-02-12 23:54:37 · 91 阅读 · 0 评论 -
2020牛客寒假算法基础集训营3
牛牛的Link Power II考虑线段树分治。区间[L,R]里的贡献分为 1、L~mid的贡献。2、R~mid的贡献。3、经过mid的贡献。对于第三种我们在维护当前区间的时候就可以直接for整个区间计算得到。前面两种通过递归继续计算。线段树正好是保存分治的过程。更多解法:题解#include <bits/stdc++.h>#include <algorithm&...原创 2020-02-09 23:23:25 · 191 阅读 · 0 评论 -
寒假实录 chapter3
Sum of Medians题意:有三个操作,add为向集合添加一个数,del是删除一个数,sum为求集合中的数经过排序后下标模5为3的数的和。权值线段树每个节点维护区间的数的个数和区间模5的结果的各个加和。有点妙//#include <bits/stdc++.h>#include <algorithm>#include <cstdio>#inc...原创 2020-01-28 22:40:15 · 163 阅读 · 0 评论 -
GDUT-14(补题)
免费送气球Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 359Accepted Submission(s): 70Problem Description又到了GDUT一年一度的程序设计竞赛校赛的时间啦。同学们只要参加...原创 2019-03-18 13:32:49 · 237 阅读 · 0 评论 -
杭电多校第三场
Find the answerTime Limit: 4000/4000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1331Accepted Submission(s): 408Problem DescriptionGiven a sequence of ...原创 2019-07-30 14:55:49 · 521 阅读 · 0 评论 -
杭电多校第四场
K-th Closest DistanceTime Limit: 20000/15000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 2669Accepted Submission(s): 950Problem DescriptionYou have a...原创 2019-08-03 19:27:16 · 160 阅读 · 0 评论 -
杭电多校第二场
Harmonious ArmyTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1151Accepted Submission(s): 402Problem DescriptionNow, Bob is play...原创 2019-08-04 15:48:30 · 145 阅读 · 0 评论 -
2019CCPC网络赛
入报名链接)~ path Time Limit: 2000/2000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1411Accepted Submission(s): 300 Problem Descriptio...原创 2019-08-25 15:36:14 · 2813 阅读 · 0 评论 -
2019ICPC宁夏网络赛
Lamis is a smart girl. She is interested in problems about sequences and their intervals.Here she shows you a sequence of lengthnnwith positive integers, denoted bya_1, a_2, a_3, \cdots , a_na1,...原创 2019-09-03 09:39:46 · 276 阅读 · 0 评论 -
HDU多校第九場
Rikka with CakeTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1267Accepted Submission(s): 503Problem DescriptionRikka's birthday i...原创 2019-09-04 10:00:01 · 103 阅读 · 0 评论 -
2019杭电多校第6场
Snowy SmileTime Limit: 4000/4000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 2996Accepted Submission(s): 953Problem DescriptionThere arenpirate che...原创 2019-09-05 11:06:21 · 157 阅读 · 0 评论 -
2019徐州网络赛I题
题目Given a permutationppof lengthnn, you are asked to answermmqueries, each query can be represented as a pair(l ,r )(l,r), you need to find the number of pair(i ,j)(i,j)such thatl \le i <...原创 2019-09-09 18:10:44 · 249 阅读 · 0 评论 -
2019南昌邀请赛网络赛J题
DSM(Data Structure Master) once learned about tree when he was preparing for NOIP(National Olympiad in Informatics in Provinces) in Senior High School. So when in Data Structure Class in College, he i...原创 2019-10-05 16:03:28 · 143 阅读 · 0 评论 -
线段树(小整理)
求区间和;LL sum[maxn<<2];//保存区间和LL add[maxn<<2];//懒惰标记LL a[maxn];//用于输入保存数据求区间和的函数:void pushup(int x){ sum[x]=sum[x<<1]+sum[x<<1|1];}建立线段树:void buildtree(int l...原创 2018-08-01 23:23:04 · 133 阅读 · 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.Inp...原创 2018-08-08 15:57:34 · 170 阅读 · 0 评论