
模板
文章平均质量分 79
MingJunYi
我的 cnblog :https://www.cnblogs.com/WG-MingJunYi
bilibili 竞赛专用号:https://space.bilibili.com/3546617684691014
日常号:暂未填写
展开
-
loj193 历史和线段树 手把手教学
loj193 历史和线段树实现一个数据结构,可以实现:区间加查询区间历史和这个历史和线段树,可以使用矩阵来帮助理解。我们如何得到历史和呢?我们可以构造一个向量:[hissumlen]\begin{bmatrix} his \\ sum \\ len \\\end{bmatrix}hissumlenhishishis 用来记录历史和,sumsumsum 记录目前区间和,lenlenlen 记录区间长度。先考虑如何更新区间和(做区间加操作),我们可以构造这样一个矩阵:原创 2024-10-14 17:27:26 · 1174 阅读 · 0 评论 -
灵活的矩阵结构体
【代码】灵活的矩阵结构体。原创 2024-10-05 17:20:00 · 170 阅读 · 0 评论 -
模板大集合 - Part 4
因为 $ 1 \leq n,m \leq 10$ 用。还是能排上用场的 – NOIP2022 微信步数。如图,蓝色轮廓线状态只能转移到含一个紫色的状态。使用的关键在于发现状态数并不多,用。的 转移 和 轮廓线 息息相关。进制数来表现轮廓的状态。进制压缩状态就可以了。原创 2024-08-21 12:57:13 · 804 阅读 · 0 评论 -
模板大集合 - Part 3
P3810 【模板】三维偏序(陌上花开)CDQ分治:#include<bits/stdc++.h>using namespace std;#define int long longint rd() { int x = 0, w = 1; char ch = 0; while (ch < '0' || ch > '9') { if (ch == '-') w = -1; ch = getchar(); } while (ch >= '0' &原创 2024-08-21 12:56:28 · 766 阅读 · 0 评论 -
模板大集合 - Part 2
网络流Dinic#include <某.h>using namespace Atomic::fastSTD;using namespace AllRangeApply_Define;namespace my{const int M = 200005,N = 10005; int head[N],to[M],nxt[M],val[M],cnt = 1;void addedge(int u,int v,int w){ nxt[++cnt] = head[u]; to[cn原创 2024-08-21 12:54:21 · 376 阅读 · 0 评论 -
模板大合集 - Part 1
树状数组#include <bits/stdc++.h>using namespace std;#define lowbit(x) (x&(-x))#define int long longconst int N = 1e6+5;int a[N],n,q,opt,i,x,tree[2*N];inline void update(int x,int d){ while(x <= n) { tree[x] += d; x += lowbit(x); }}原创 2024-08-21 12:52:07 · 926 阅读 · 0 评论