11 2022 档案
摘要:problem 有 名同学要乘坐摆渡车从人大附中前往人民大学,第 位同学在第 分钟去 等车。只有一辆摆渡车在工作,但摆渡车容量可以视为无限大。摆渡车从人大附中出发、 把车上的同学送到人民大学、再回到人大附中(去接其他同学),这样往返一趟总共花费 分
阅读全文
摘要:当年这个题是 0 分,连区间 DP 都没看出来。 problem 小 w 在赛场上遇到了这样一个题:一个长度为 且符合规范的括号序列,其有些位置已经确定了,有些位置尚未确定,求这样的括号序列一共有多少个。 身经百战的小 w 当然一眼就秒了这题,不仅如此,他还觉得一场正式比赛出这么简单的模板题
阅读全文
摘要:模拟退火适用范围:寻找最优解,估价函数复杂度小,状态巨大。所以它也不是万能的。
阅读全文
摘要:基环树森林带权最大独立集。 。
阅读全文
摘要:BZOJ1023:求一个无权仙人掌的直径,要求线性。
阅读全文
摘要:Tarjan 与图的连通性的全家桶!!!包括:缩点、点双、边权、圆方树、2-sat
阅读全文
摘要:大模拟,大暴力!
阅读全文
摘要:虚树,是原树的一种子树,只储存和关键点有关的信息,时空复杂度做到均摊。
阅读全文
摘要:毕业了。以后打 Div.3 可能就是 unoffical 了。我也希望是这样的。
阅读全文
摘要:本地 Dev-C++ 编译,没有任何参考价值。
阅读全文
摘要:posted on 2021-11-19 15:41:01 | under 模板 | source posted on 2021-06-12 09:53:53 | under 学术 | source posted on 2022-07-30 14:50:21 | under 模板 | source
阅读全文
该文被密码保护。
摘要:2025.2.7 添加内容 参考文献:题解 P4717 【【模板】快速莫比乌斯/沃尔什变换 (FMT/FWT)】 - 洛谷专栏 下文不区分 FWT 和 FMT 而统一称作 FWT。 目录题目描述卷积运算律三种卷积按位异或卷积按位或卷积按位与卷积线性性矩阵形式FWT 是系数转点值快速修改系数按位独立性
阅读全文
摘要:线段树大杂烩,然而线段树的题难点都不在线段树()
阅读全文
摘要:一个黑白矩阵,求以每个点为右下角,能围出的周长最大的全白矩形的周长。 。
阅读全文
摘要:棋盘上做八皇后问题,已经摆了 3 个,请将方案补充完整,或者报告无解。
阅读全文
摘要:problem 连通图,无自环,无重边, , , 询问两点之间最短路。 solution 搞出任意一棵生成树。一共 条非树边。 对于任意一条路径,它只有如下 种情况: 不经过非树边。 经过第 条非树边($1\leq
阅读全文
摘要:posted on 2022-10-20 13:58:54 | under 题解 | source ~~有个地方写错了,改一下~~ problem Soso 有一个无穷序列 定义如下: $$X_i=\begin{cases} S,&(i=0)\ (A\cdot X_{i-1}+B)\
阅读全文
摘要:posted on 2022-07-25 20:12:26 | under 题解 | source 做法:矩阵优化 DP + 容斥原理。 矩阵优化 DP 先不要考虑商品,写个不管约束条件的 DP。令 表示在 时刻安娜在结点 上的方案数。初始时有 $f_{0,1}=
阅读全文
摘要:将一个排列通过任意两项交换变为升序的最小次数 / 方案数,是经典计数模型。
阅读全文
摘要:posted on 2022-10-28 14:11:41 | under 题解 | source problem 给出一个网格图,其中某些格子有财宝,每次从左上角出发,只能向下或右走。问至少走多少次才能将财宝捡完。此对此问题变形,假设每个格子中有好多财宝,而每一次经过一个格子至多只能捡走一块财宝,
阅读全文
摘要:problem 将一个排列中所有逆序对连起来,如果连出来一个二分图,我们说它是一个二分图排列。 给一个排列 ,可以选择若干个 使得 (取相反数),请把 变成字典序最小的二分图排列,或者报告无解。 。 solution 0 结论一
阅读全文
该文被密码保护。
摘要:posted on 2021-04-16 19:58:01 | under 题解 | source ~~想看代码的直接跳 Day 6~~ ~~这题不能发题解,所以这是做题记录~~ 做题原因:499AC,教练推荐我切这题 ~~遗言~~前言:早就听说了这个大%你,它让每一个挑战者失去梦想。打开最优解,3
阅读全文
摘要:posted on 2021-07-14 19:19:57 | under 题解 | source 首先我们先算一下网格最多可能有多少种状态,很显然是 ,完全可以暴力搜索。 那怎么实现呢?可以使用 bfs,以初始状态开始,每次找空格子,将空格子四周的数字移过来,完成状态的扩展。 但
阅读全文
摘要:posted on 2021-08-03 16:20:45 | under 题解 | source bfs + 二分。 首先算出一个数组 ,表示 这个格子与离它最近的树的距离。这个过程可以参考 P1332 血色先锋队,把所有树的位置扔队列里,一起做一次 bfs。 接
阅读全文
摘要:posted on 2021-06-21 20:30:31 | under 题解 | source 这道题,有两个比较恶心的点: 「between two given integers A and B」,说的是 和 之间,并没有保证 ; 「subsequence」指的是子序
阅读全文
摘要:posted on 2021-06-02 20:59:42 | under 题解 | source SP11198 是个神题,它考察了选手们的记忆、乱搞、找规律、压行能力。 本题题解是乱搞题解,没有证明。 下面就由我来解说一下: 第二问 重新读一下题,注意几个关键信息: (
阅读全文
摘要:posted on 2021-07-10 20:00:18 | under 题解 | source 观察题目,发现它说了这么多其实是想让我们写一个数据结构支持: 单点修改(区间长为 的区间修改); 区间赋值; 区间计算 的素数个数。 看到"区间赋值"这个操作,我们不难想到 O
阅读全文
摘要:posted on 2021-07-16 16:44:09 | under 题解 | source 【模板】括号匹配 #include <string> #include <iostream> using namespace std; char mp[128],s[100010]; int top=
阅读全文
摘要:posted on 2021-07-15 11:39:02 | under 题解 | source 把两个点联通,查询两个点是否联通,显然可以用并查集维护。 但是,这题没有这么简单,输入输出很坑。简单地列一下需要注意的点吧: 数据组数 后有一个空行; 每组数据以一个空行或 EOF 为结束标志
阅读全文
摘要:posted on 2021-05-13 19:37:25 | under 题解 | source 这是一道练习 fread 和 fwrite 的好题。 那么我们先来认识一下 fread 和 fwrite: fread fread 定义于 cstdio 头文件中,它的函数原型为: size_t fr
阅读全文
摘要:posted on 2021-03-01 18:05:25 | under 题解 | source 此题正解是记忆化搜索,我们先考虑暴力 dfs。 显然,我们可以在 中传 个参数: ,分别表示当前的位置和滑雪路径的长度。每次更新答案,
阅读全文
摘要:posted on 2021-07-10 20:33:18 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/348063) 非常经典的求逆序对个数问题。An inversion is a pair of indices $(i,j)
阅读全文
该文被密码保护。
摘要:posted on 2022-10-30 11:39:14 | under 题解 | source problem 一个 个点 条边的有向图, 次操作: 删除一条边,保证存在; 增加一条边,保证不存在; 删除一个点的所有入边; 将一个点曾经有的入边全部恢复。 每次操作后判断:
阅读全文
摘要:posted on 2022-10-30 20:49:17 | under 题解 | source problem 长度为 的数组 ,长度为 的数组 。 次博弈,每次博弈给出 ,Alice 可以选择一个 $i\in[l_1,
阅读全文
摘要:posted on 2022-10-29 23:32:15 | under 题解 | source problem 个点 条边的无向无权图,令 ,点带权 ,求: $$[*]=\max_{
阅读全文
摘要:posted on 2021-10-23 22:52:47 | under 题解 | source 分类讨论。 一句话题意:求 首先画个数轴,按除以 向下取整的商把这些整数分块,大概是这样: 容易看出每块中的整数 $\bmo
阅读全文
摘要:posted on 2020-11-12 17:22:31 | under 题解 | source 本题正解是二进制 or 位运算 理解题目 P7071 优秀的拆分(民间数据) 题目链接: https://www.luogu.com.cn/problem/P7071。 现在给你一个正整数 ,请
阅读全文
摘要:posted on 2022-10-30 16:27:18 | under 题解 | source problem 一棵 个点的树。如果两个点在树上的距离不超过 ,我们称这两个点可以互相传送信息。现在 次给定 ,选出 $h={h_1=s,h_2,h_3,\cdots,
阅读全文
摘要:posted on 2022-10-28 08:41:23 | under 题解 | source problem Takahashi 和 Aoki 正在一张 个点, 条边的带权有向图上玩游戏。游戏规则如下: 有一颗最初在 点的棋子。双方轮流移动这颗棋子,Takahashi 先
阅读全文
摘要:posted on 2021-02-07 18:12:18 | under 题解 | source 题意简述 给出一长为 的数列 和一长为 的数列 ,你可以交换 的位置,但不能交换 的位置,你需
阅读全文
摘要:problem 定义一个 0/1 矩阵 的复杂度为: 若 只由一种数字组成,其复杂度为 。 否则,用一条平行于矩阵 任意一边的直线将 划分为两部分,则复杂度为所有划分方案中 两个子矩阵的复杂度的最大值加一 的最小值。 求出一个 的 0/1
阅读全文
该文被密码保护。
该文被密码保护。
该文被密码保护。
该文被密码保护。
摘要:希望 NOIP2022 GD 赛区能正常举办!(广东实验集训)
阅读全文
摘要:停课以来,每天都是模拟赛;怎么说呢,有点想念我的学校。(广东实验集训)
阅读全文
摘要:posted on 2022-10-28 22:41:08 | under 日志 | source GD 已经有代码了!游记写在代码里,搬过来吧。 2022.10.29。 GD-J00015 / GD-S00013。 FS 石门中学。 震惊:两个编号如此接近! day 0 在 SS 机房颓废。 CM
阅读全文
摘要: 表示以 为中心的(原串的)回文串长度 点击查看代码 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; int n,m,
阅读全文
摘要:posted on 2021-02-25 18:23:15 | under 学术 | source 数组 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; template<int N> st
阅读全文
摘要:posted on 2021-09-20 00:05:18 | under 灌水 | source 如果你记了答案可以测一下(误) S #include <cctype> #include <string> #include <cstring> #include <iostream> #includ
阅读全文
摘要:posted on 2021-09-19 22:34:52 | under 题解 | source 人在佛山,考场在南外。 学校信息队太强了,不仅租车还包午饭,点赞。 来写一下我做题经历吧: S 组 官方答案: ABACCCCBDACCCB TFFTDC TFFBCB FTFBDD DADCADAD
阅读全文
摘要:posted on 2022-07-26 15:03:06 | under 学术 | source 太难所以要写,我太菜了。 斜率优化 problem 形如 的式子可以被斜率
阅读全文
摘要:posted on 2022-05-28 12:02:29 | under 题解 | source 感谢 vjudge.net 提供技术支持。 https://vjudge.net/contest/497115#overview CF771A Bear and Friendship Conditio
阅读全文
摘要:posted on 2022-08-12 14:14:05 | under 模板 | source 感谢讲师 LQS 带来的网络流专题。 本文非常不严谨,请不要把它当作入门博客。 codes 最大流:Dinic 实现(version 1) typedef long long LL; template
阅读全文
摘要:posted on 2022-10-15 16:45:09 | under 题解 | source 什么是李超线段树? 李超线段树是一种可以插入直线,单点查询 的线段树,用了标记永久化的技巧。 修改时一路走下去,最多递归一边,啥都不用管。 李超线段树除了全局插入直线,单点询问
阅读全文
摘要:posted on 2021-11-16 12:50:02 | under 模板 | source ~~英语不好啊,就叫 treecut 吧,不管了~~ treecut 速成(确信): 重儿子:所有儿子节点中 siz 最大的。重链:以轻儿子(钦定 root 为轻儿子)开始一直往重儿子走的一条链。 d
阅读全文
摘要:posted on 2021-08-27 19:17:02 | under 模板 | source 万恶之源:初赛完善程序 一些定义: #include <cstring> #include <algorithm> using namespace std; const int maxn=1e5,ma
阅读全文
摘要:posted on 2022-07-22 15:16:41 | under 模板 | source 离散花 template<int N> struct flower{ int b[N+10],cnt; flower():cnt(0){} void operator+=(int x){b[++cnt
阅读全文
摘要:posted on 2022-11-02 18:51:48 | under 模板 | source link -> https://www.cnblogs.com/caijianhong/p/template-suffixam.html 重要结论:反串上跳 fail 等价于正串上跳 next。 点击
阅读全文
摘要:posted on 2021-09-04 20:03:43 | under 模板 | source 点击查看代码 template <int N, int M, class T> struct graph { int head[N + 10], nxt[M << 1], cnt; struct ed
阅读全文
摘要:posted on 2022-07-21 14:10:58 | under 模板 | source typedef long long LL; template<int N> struct fhqtreap{ int val[N+10],pri[N+10],siz[N+10],x,y,z,root;
阅读全文
摘要:posted on 2022-09-17 15:59:26 | under 模板 | source code LL mod(LL x,LL m){return(x%m+m)%m;} LL exgcd(LL a,LL b,LL c,LL& x,LL& y){ if(!b) return x=c/a,y
阅读全文
摘要:posted on 2021-08-17 09:15:04 | under 模板 | source 可清空 template<int N> struct fenwick{ int t[N + 10]; fenwick() { memset(t, 0, sizeof t); } void add(in
阅读全文
摘要:posted on 2022-08-07 17:04:40 | under 模板 | source 目录后缀数组code证明 只会越界到 证明解决方法构造数据求两个后缀的 LCP求 在原串的出现次数本质不同的子串个数(位置不同算相
阅读全文
摘要:posted on 2022-08-07 20:50:14 | under 模板 | source updated on 20230727:增补更多细节,合并广义 SAM 相关。 点击查看闲话 广义后缀自动机,建议看这篇理解会更深(口语化警告) <- 已经加入后缀自动机豪华套餐 保存:基本子串结构
阅读全文
摘要:posted on 2022-01-25 18:52:13 | under 模板 | source typedef long long LL; const int P = 998244353; template <int N, int M, class T = LL> struct matrix {
阅读全文
摘要:posted on 2022-10-23 13:50:24 | under 模板 | source problem 给定一个二维平面,多次询问 的点有多少个。 solution 1(静态+在线):可持久化线段树 将
阅读全文
摘要:posted on 2021-11-27 22:37:04 | under 模板 | source sto crxis 注:不是 tarjan void crxis(int u){ for(int i=g.head[u];i;i=g.nxt[i]){ int v=g[i].v; if(dep[v]=
阅读全文
摘要:posted on 2022-07-20 18:59:16 | under 模板 | source 0x00 模板(P3806) 给定 和一棵树,计算 即树上距离为 的点对数量。 点分治
阅读全文
摘要:posted on 2021-09-12 15:49:52 | under 模板 | source 感觉不如直接复制 template <int N> struct dsu { int fa[N + 10], siz[N + 10], cnt; explicit dsu(int n = N) : c
阅读全文
摘要:posted on 2022-07-22 19:15:58 | under 模板 | source template<int N,class T=int,int logN=20> struct STable{ int tot,lg[N+10];T f[logN+1][N+10]; STable():
阅读全文
摘要:posted on 2022-10-18 13:30:17 | under 模板 | source const char* name="bit"; #include <cstdio> #include <cstring> #include <algorithm> using namespace st
阅读全文
摘要:posted on 2022-08-17 18:05:59 | under 模板 | source template<int N> struct lctree{ int val[N+10],sum[N+10],fa[N+10],ch[N+10][2],rev[N+10]; bool getson(i
阅读全文
摘要:posted on 2022-07-21 17:03:54 | under 模板 | source (介绍等会补) 调试: getpre、getsuf、find 手写,常数不要乘以二。 UB:getkth 和 getrnk 叠起来的时候 root 会改! UB:getpre、getsuf 的 val
阅读全文
摘要:posted on 2022-02-04 18:11:33 | under 模板 | source int popcount(int x){ #define BIT2(n) n,n+1,n+1,n+2 #define BIT4(n) BIT2(n),BIT2(n+1),BIT2(n+1),BIT2(
阅读全文
摘要:posted on 2022-08-10 18:07:25 | under 模板 | source 0x00 Bellman-Ford 最短路经过的边数不超过 ,因此若松弛轮数达到 轮即有负环。复杂度 。 int dis[100010]; bool vis[10001
阅读全文
摘要:posted on 2022-06-11 11:17:10 | under 模板 | source template<int N,int M=26,int D='a'> struct acam{ int ch[N+10][M],cnt[N+10],tot,fail[N+10]; int sum[N+
阅读全文
摘要:posted on 2022-01-17 16:13:39 | under 模板 | source #include <cstdio> #include <cstring> #include <algorithm> using namespace std; template<int N,int M=
阅读全文
摘要:你好,博客园!——2022.11.6
阅读全文