线段树
-lyslyslys
菜狗一个
展开
-
Data Structure?
Data structure is one of the basic skills for Computer Science students, which is a particular way of storing and organizing data in a computer so that it can be used efficiently. Today let me introdu...原创 2019-04-04 10:55:53 · 1373 阅读 · 0 评论 -
温暖的签到题
链接:https://ac.nowcoder.com/acm/contest/892/D来源:牛客网题目描述给你一个长度为n的序列,初始为1,2,3...n,对其进行m次操作。操作有两种:1 l r 表示将区间[l,r]用 [1,2...r-l+1] 覆盖2 l r 查询[l,r]的区间和输入描述:第一行包含2个数字,n,m(1 <= n,m <=...原创 2019-05-13 15:24:56 · 448 阅读 · 0 评论 -
线段树模板
先转载一个大佬的代码:/** 有 n 个数和 5 种操作add a b c:把区间[a,b]内的所有数都增加 cset a b c:把区间[a,b]内的所有数都设为 csum a b:查询区间[a,b]的区间和max a b:查询区间[a,b]的最大值min a b:查询区间[a,b]的最小值*/#include <bits/stdc++.h>using nam...原创 2019-05-13 15:45:16 · 326 阅读 · 0 评论 -
线段树综合
单点操作和区间查询#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<queue>#include<map>#include<set>#defi...原创 2019-07-08 18:34:26 · 133 阅读 · 0 评论 -
树状数组 板子1-单点修改区间查询
#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#include<queue>#include<map>#include<set>#define inf 0x3f3...原创 2019-07-13 11:29:53 · 166 阅读 · 0 评论 -
线段树板子2
区间修改O(log2(n))ll st[MAXN<<2],stmin[MAXN<<2],stvis[MAXN<<2],stmax[MAXN<<2];ll a[MAXN];void push_up(int rt){ stmax[rt]=max(stmax[lson],stmax[rson]); stmin[rt]=min(...原创 2019-07-04 14:09:04 · 134 阅读 · 0 评论