线段树
c_3Po_
这个作者很懒,什么都没留下…
展开
-
2015年蓝桥杯C/C++省赛大学A组 灾后重建 (树上倍增最值+线段树)
题目链接100分的做法:当p>sqrt(n)时, 这时候%p=c的点不超过k个, 直接倍增求路径最值就好了当p<=sqrt(n)时,将询问离线, 按照p和c从小到大排序,同时处理出所有p相同且c相同的区间询问对于同一个p[i]和c[i],将所有%p[i]=c[i]的点, 两两(c[j]和c[j]+p)求路径最大值, 并将这个相邻最大值更新到线段树上, 对于一个区间的询问,...原创 2020-03-03 21:41:15 · 696 阅读 · 0 评论 -
2019 icpc 银川区域赛 G Pot!! (线段树)
#include <bits/stdc++.h>const int maxn = 1e5 + 5;int n,q;struct SegTree{ int maxx[maxn<<2],lazy[maxn<<2]; inline void pushdown(int o) { if(lazy[o]) {...原创 2019-11-30 13:23:05 · 475 阅读 · 0 评论 -
Codeforces Round #603 (Div. 2) E. Editor (线段树维护全局最值)
题目链接#include <bits/stdc++.h>const int maxn = 1e6 + 5;int sum[maxn<<2],mi[maxn<<2],ma[maxn<<2],n;char s[maxn];void update(int o,int l,int r,int pos,int c){ if(l=...原创 2019-11-30 01:54:48 · 335 阅读 · 0 评论 -
hdu 1698 Just a Hook (线段树)
题意:t组数据,给你n个数,初始为1,q次操作 区间更新线段树裸题,但是我wa了好几次。。。因为最后输出的那个hook 我写成了book。。看了半天都没发现#include <bits/stdc++.h>using namespace std;typedef long long LL;const int maxn=1e5+5;const int maxm=5e...原创 2019-03-04 23:33:14 · 94 阅读 · 0 评论 -
洛谷 P3372 线段树模版题
题目描述如题,已知一个数列,你需要进行下面两种操作:1.将某区间每一个数加上x2.求出某区间每一个数的和输入输出格式输入格式:第一行包含两个整数N、M,分别表示该数列数字的个数和操作的总个数。第二行包含N个用空格分隔的整数,其中第i个数字表示数列第i项的初始值。接下来M行每行包含3或4个整数,表示一个操作,具体如下:操作1: 格式:1 x y k 含义:将...原创 2019-03-04 13:29:23 · 202 阅读 · 0 评论 -
2019 icpc南昌邀请赛网络赛 J - Distance on the tree
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-04-21 22:20:45 · 468 阅读 · 0 评论 -
华南理工大学“三七互娱杯”程序设计竞赛(重现赛)B HRY and fibonacci
链接:https://ac.nowcoder.com/acm/contest/874/B来源:牛客网题目描述HRY is a pupil. He has just learned about Fibonacci sequence recently, and he made some new sequences :fic(n)=∑ni=1fib(i)fic(n)=∑i=1n...原创 2019-04-28 20:18:53 · 292 阅读 · 0 评论 -
poj 2104 K-th Number (静态区间第K大 主席树)
题目链接You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to retu...原创 2019-04-24 19:04:54 · 85 阅读 · 0 评论