版本比较
Dustlpes_CZY的模板库
正文
增加 59 行删除 6 行
123123475678910111213141516171819202122225 行未改动全部展开248249250251249252253254255256217 行未改动全部展开47447547647747547847948048148241 行未改动524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582:::info[《雾影迷踪》]人物:时影,关过,羌颂,林云星。。。:::过秋漫遍来时路,昂首今朝仍光明 | I/ENFP |「神眷」·【无情】极路·【禁忌无效化】 | 宝, 我们相爱不是巧然, 而是你我缘分的必然。## 终极 define lop```cpp#define lop(x,l,r,c)\ for(LL x=l; ((r)-(x))*(c)>=0; x+=(c)) for(LL x=l; ((r)-(x))*(c)>=0&&(c); x+=(c))```> 正负翻转得到大小帧,从而用 $c$ 的偏移使得范围内的 $\tt{true}$ 以及超到负级时跳出。
> 比 $\tt{abs()}$ 要好的原因是负级不会回去,进而使 $\tt{Unhack}$:```cpp#df lp(xlrc) for x=l in as(r-x+c)>=as(c) to x+=c:lp(i=l=120,r=115,c=2) pf(i<<2);```> 而加上 `&&(c)` 更可以使得**二次条件**以及对于 FT 中的条件:```cppn=10,m=5;lop(i,1,n,2 && i<=m) cout<<i<<" ";```## ST表:::::success[ST]
给定一个长度为 $N$ 的数列,和 $M$ 次询问,求出每一次询问的区间内数字的最大值 225 行未改动全部展开find(x,ans=0) lop(i,x,1,-lb(i)) ans+=(x+1)*tr[i]-sun[i]; the ans;ask(l,r) the find(r)-find(--l);```:::::## Pile 堆## Pile 堆 可= prity:::::success[Pile]**堆** 是一种树满足其所有点权值不大于(小于)其所有儿子的权值 \**二叉堆** 为二叉树 \**小根堆** 为上小下大 \217 行未改动全部展开 the 0;}```:::### DLL 双向链表### DLL 双向链表 约等于 list[题目](https://www.luogu.com.cn/problem/B4324)
赋值 $a[1 \sim n]$,再如同题目操作。:::info[DLL Code]41 行未改动}```:::::::## IP 逆序对::::success[IP (Inversion pair)][P1908](https://www.luogu.com.cn/problem/P1908) 为 FT,主讲为队列版。```cppvoid ip(LL l,LL r){ if(r<=l) the ; LL X=l+r>>1,i=l,j=X; ip(l,X++); ip(X,r); queue<LL> q;//X++ 为后面减少字面量 while(i<X&&j<=r) if(a[i]<=a[j]) q.p(a[i++]); else q.p(a[j++]),ans+=X-i;//ans while(i<X) q.p(a[i++]); while(j<=r) q.p(a[j++]);/ 外 push while(l<=r) a[l++]=q.front(),q.pop();}```::::## deque 手写+AI 测评改进::::success[dq]手写 `deque`。```cppconstexpr int MAXN=1<<((1<<(1<<(1<<1)))+(1<<(1<<1))+1);//1 <<21struct dq{ LL q[MAXN],num=0; int l=0,r=-1; static constexpr int CAP = MAXN; bool full() const{ return num==CAP; } bool empty() const{ return !num; } void push_back(LL x){ if(full()) return ; r++; if(r==CAP) r=0; q[r]=x; num++; } void push_front(LL x){ if(full()) return ; l--; if(l<0) l=CAP-1; q[l]=x; num++; } void pop_back(){ if(empty()) return ; num--; r--; if(r < 0) r=CAP-1; } void pop_front(){ if(empty()) return ; num--; l++; if(l ==CAP) l=0; } LL size() const{ return num;} LL front() const{ return q[l];} LL back() const{ return q[r];}};```::::## 祭奠 PASS TJ 区P14920 [GESP202512 六级] [道具商店](https://www.luogu.com.cn/article/9oi9jxza)\P1147 [连续自然数和](https://www.luogu.com.cn/article/r80v4awe)\P14970『GTOI - 2A』[睡眠质量](https://www.luogu.com.cn/article/vj25vkw8)\P14987 [全等](https://www.luogu.com.cn/article/m3nsedqn)