![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
TheSunInTheMorning
这个作者很懒,什么都没留下…
展开
-
线段树例题
1.G - Xenia and Bit Operations #include <bits/stdc++.h> using namespace std; typedef long long ll; #define lson root << 1 #define rson root <<1|1 const ll MAXN = 1<<17; ll input[MAXN]; struct Node { ll l, r ; ll val,原创 2021-05-17 20:23:32 · 81 阅读 · 0 评论 -
基础数据结构之线段树
定义 root 为根节点 lson 为左子节点 (#define lson root <<1 ) rson为右子节点 (#definr rson root <<1 | 1) 线段树中的重要内容 1、定义结构体 struct Node { ll l, r ; ll val, lazy; } tr[10*MAXN]; 定义 l r 代表 tr[x] 包含了从tr[ x ].l ~ tr[ x ].r的信息 val是该节点的值 lazy是为了进行区间操作的优化原创 2021-04-20 19:57:23 · 135 阅读 · 0 评论