sb代码选集

· · 个人记录

学习 \color{black}\text{S}\color{red}\text{yadouHayami} 开了一个sb代码选,用于警告后人(指我,其他人都不会犯这种错误的)

2020/08/12


经常性这么写。

改正:if(!dfn[u]) \rightarrow if(!dfn[v])

2020/08/16

改正: j=p[i] \rightarrow j=p[j]


改正:

for(int i=0;i<s.size();i++)
\downarrow
int siz=s.size();
for(int i=0;i<siz;i++)

2020/08/24

感冒,降智,确认完毕。

2020/09/07

for(int i=lg[dep[i]];i>=0;i--)

--- 2020/09/23 斜率优化: ![单调队列](https://cdn.luogu.com.cn/upload/image_hosting/7dpewory.png) `deq[i]` $\rightarrow$ `i` --- 2020/10/22 树剖: ![](https://cdn.luogu.com.cn/upload/image_hosting/fq5gcia2.png) `x` $\rightarrow$ `top[x]` `top[x]` $\rightarrow$ `x` --- 2020/10/31 多测,特判: ![](https://cdn.luogu.com.cn/upload/image_hosting/960o48bw.png) 特判放后面 --- 2020/11/17 ![](https://cdn.luogu.com.cn/upload/image_hosting/4nrchidb.png) `rson p<<1···` $\rightarrow$ `rson p<<1|1 ···` --- 2020/11/26 ![](https://cdn.luogu.com.cn/upload/image_hosting/3h1jfq9y.png) `deg` 开的 `int` 这是道期望题。 --- 2020/12/21 ![](https://cdn.luogu.com.cn/upload/image_hosting/glr4meiw.png) 两行交换位置。 --- 2021/01/04 ![](https://cdn.luogu.com.cn/upload/image_hosting/mkotgmf1.png) `Paint(1,1)` $\rightarrow$ `Paint(i,1)` --- 2020/2/22 ![](https://cdn.luogu.com.cn/upload/image_hosting/obpulbq7.png) `s[i]-'0'` $\rightarrow$ `s[i]-'a'` --- 2020/2/23 LCT板子 ![](https://cdn.luogu.com.cn/upload/image_hosting/k5ga3imw.png) `fa[y]=y` $\rightarrow$ `y=fa[y]` ---- 2021/2/24 LCT,调了半个小时 ![](https://cdn.luogu.com.cn/upload/image_hosting/cjdhgz00.png) `y=1` $\rightarrow$ `y=0` --- 2021/3/5 求最小生成树的一部分 ![](https://cdn.luogu.com.cn/upload/image_hosting/kz5wku2d.png) 交换两行顺序。 ---- 2021/04/13 点分治求重心 ![](https://cdn.luogu.com.cn/upload/image_hosting/7cx1ds4u.png) `u=rt` $\rightarrow$ `rt=u` --- 2021/06/29 并查集初始化 ![](https://cdn.luogu.com.cn/upload/image_hosting/wl0b2rk2.png) `cnt<<i` $\rightarrow$ `cnt<<1` 并查集找根 ![](https://cdn.luogu.com.cn/upload/image_hosting/yg5wkegz.png) `fa[x]==findSet(fa[x])` $\rightarrow$ `fa[x]=findSet(fa[x])` --- 2021/07/01 怎么T飞的都不知道 ![](https://cdn.luogu.com.cn/upload/image_hosting/lkd1tcsk.png) 去掉循环 --- 2021/07/20 线段树修改 ![](https://cdn.luogu.com.cn/upload/image_hosting/zcklf3n3.png) `aim<=val` $\rightarrow$ `mid<=val` `val<aim` $\rightarrow$ `val<mid` 又是半个小时 --- 2021/07/26 NOI 2021 D1T2 的暴力 ![](https://cdn.luogu.com.cn/upload/image_hosting/45tonv3o.png) `bool` $\rightarrow$ `int` 以后不要看到check就bool(确信 --- 2021/08/25 某道多项式题,不过这并不重要。 但是编译器连个警告都不给! ![](https://cdn.luogu.com.cn/upload/image_hosting/3tv00uhp.png) `j<=j` $\rightarrow$ `j<=Sum` --- 2021/08/26 树剖 ![](https://cdn.luogu.com.cn/upload/image_hosting/vxzypoa5.png) 把清空放到后面 --- 2021/09/23 ![](https://cdn.luogu.com.cn/upload/image_hosting/o521yuba.png) `==` $\rightarrow$ `=` --- 2021/10/19 ![](https://cdn.luogu.com.cn/upload/image_hosting/6wxq5cbn.png) 类·不开 `long long` 见祖宗 `1e9` $\rightarrow$ `1e18` --- 2021/11/15 ![](https://cdn.luogu.com.cn/upload/image_hosting/edlmhn0l.png) 括号嵌套大问题 `Slo(deq[mid],deq[mid-1]>Slo(deq[mid],x))` $\rightarrow$ `Slo(deq[mid],deq[mid-1])>Slo(deq[mid],x)` --- 2022/03/29 ![](https://cdn.luogu.com.cn/upload/image_hosting/0qgd8l2q.png) 巨大抽筋 最后一行 `tr[p]` $\rightarrow$ `ret` --- 2022/05/04 NTT ![](https://cdn.luogu.com.cn/upload/image_hosting/pv0i62lk.png) `N++` $\rightarrow$ `N<<=1`