07 2022 档案
摘要:#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using namespace std; #define INF 0x3f3f3f int cnt=0,head[INF
阅读全文
摘要:链式前向心 int add(int next,int v,int w){ e[++cnt].v=v; e[cnt].w=w; e[cnt].next=head[next]; head[next]=cnt; } struct mp{ int v; int next; int w; }e[2000000
阅读全文
摘要:树状数组 介绍:树状数组是一种时间复杂度为log(n),空间复杂度为o(n)的算法,可以高效计算数组的前缀和,区间和。 从图中我们可以观察到 C1=A1 C2=A1+A2 C3=A3 C4=A1+A2+A3+A4 ...... C数组就是我们要建的树状数组。 1.1建立树状数组 从图中可以看到从C1
阅读全文