12 2021 档案

摘要:https://www.luogu.com.cn/problem/P1587 首先思考我们要求的是什么? \(\large \begin{Bmatrix}\frac{xk^l}{y}\end{Bmatrix} =\begin{Bmatrix}\frac{x}{y}\end{Bmatrix}\) \( 阅读全文
posted @ 2021-12-29 09:26 lahlah 阅读(81) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P4213 才发现杜教筛是个这么naive的东西,我觉得我也可以发明出来 给出狄利克雷卷积的几个重要性质 \(\mu *I=ϵ\) \(\phi*I=id\) \(\mu*id=\phi\) 满足结合律和交换律 设$\large S( 阅读全文
posted @ 2021-12-29 08:23 lahlah 阅读(27) 评论(0) 推荐(0)
摘要:菜的真实 C没看清楚数据范围炸了两发血亏 D用二项式定理展开一下就是个很naive的东西了 后两题比较有意思 E - Medals 首先可以发现天数的上限是$2n1e5$ 显然可以二分答案 先考虑如何建图 左边是员工,右边是天数,根据$Hall$定理我们知道,对于左边的每个子集 \(G\),都要满足 阅读全文
posted @ 2021-12-23 21:10 lahlah 阅读(43) 评论(0) 推荐(0)
摘要:菜的真实 T3,T4卡大题还行 C - Camels and Bridge 首先看数据范围肯定不是一个多项式复杂度的算法 考虑枚举全排列,那么怎么判断头尾最短的长度是多少呢? 其实也不难,只要把每个连续段开到必须要开长度,然后大的继承小的即可 具体实现可以看代码 code: #include<bit 阅读全文
posted @ 2021-12-22 21:39 lahlah 阅读(69) 评论(0) 推荐(1)
摘要:https://www.luogu.com.cn/problem/P7530 按照套路,我们记$pre[i]$表示上一个和$i$相同颜色的位置 考虑扫描线,记$f[l]\(为每个左端点的答案,用线段树维护就是区间\)(pre[r],r-1)$的$f[l]$和 考虑$i\in[l,r],pre[i]$ 阅读全文
posted @ 2021-12-22 08:06 lahlah 阅读(81) 评论(0) 推荐(1)
摘要:https://www.luogu.com.cn/problem/P6667 和20年省选很像,一下子没想出来怎么做,还是不够熟练 $f$由点值给出,考虑到后面有组合数,还有幂函数,不妨考把$f$写成下降幂多项式的形式 \(\sum\limits_{k=0}^n\binom{n}{k}x^k(1-x 阅读全文
posted @ 2021-12-22 07:40 lahlah 阅读(93) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P5394 之前一直以为是什么阴间东西,没有碰,现在菜知道原来是个挺naive的东西 我们把设点值的指数型生成函数为$$G(x)=\sum_{i=0}{\infin} \frac{F(i)}{i!} xi$$ \(\large =\s 阅读全文
posted @ 2021-12-21 21:43 lahlah 阅读(46) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P7531 玄妙DP题被BEST定理淦过去的这个出题人Benq就是逊啊 首先回忆一把$BEST$定理是什么 一个有向图欧拉回路的数量设为$F$,一个以$rt$为根的内向生成树个数为$G$ \(T=G\prod_{i=1}^n (in[ 阅读全文
posted @ 2021-12-21 16:34 lahlah 阅读(32) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P7416 对于每个数,记$lst[i]$表示上一个和$i$颜色相同的位置 如果$lst[i]<l$显然$ans+1$ 如果$min(lst[i],i)<a[i]$那么$ans+1$(把$lst[i]$设为$0$即可) 然后就变成了询 阅读全文
posted @ 2021-12-21 16:23 lahlah 阅读(68) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P5243 大意就是给出若$k$棵树,每棵树选一条路径,然后花$k x$的长度把他们连成一个环 问环的长度$\ge Y$的方案数 首先肯定可以先把$Y -= kx$ 然后就变成了一个经典问题,每个树暴力$n_i2$跑出来所有的方案,路 阅读全文
posted @ 2021-12-21 16:13 lahlah 阅读(53) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P4183 学到许多 显然要求出来一个$f[u]$表示离$u$最近的叶子距离 考虑对于一个节点的情况,把它设为根 求出来以它为根的每个点的深度,记为$dep[u]$ 手玩一下容易发现对于每个节点,叶子是否需要的放判断是 \(f[u]< 阅读全文
posted @ 2021-12-21 16:03 lahlah 阅读(36) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P5667 主要是要知道可以把它先便偏移一下,然后再卷积 \(b[i]=\frac{1}{m-n+i}\) code: #include<bits/stdc++.h> #define ll long long #define mod 阅读全文
posted @ 2021-12-17 09:05 lahlah 阅读(71) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF997C![在这里插入图片描述](https://img-blog.csdnimg.cn/2cd5342716b64cc5be90f552ad307b41.png?x-oss-process=image/watermark,typ 阅读全文
posted @ 2021-12-17 09:02 lahlah 阅读(74) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P4707 $kthmin-max$容斥入门题 懒得证明了 式子就是 \(\max(S)=\sum_{T⊆S}(-1)^{|T|-k}\binom{|T|-1}{k-1}\min(T)\) 设计DP $f[i][j][k]$表示考虑前 阅读全文
posted @ 2021-12-17 09:01 lahlah 阅读(46) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P4332 成功复习了LCT 首先发现状态改变的一定是叶子向上的一条路径 我们记录$sum[u]$表示$u$节点有几个儿子是$1$,\(val[u]=sum[u]>1\) 这样维护最大值和最小值,每次$access$一下然后在$Spl 阅读全文
posted @ 2021-12-17 08:49 lahlah 阅读(45) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P2791 赞美出题人(bushi 如果做过luogu P6031 CF1278F Cards 加强版 这题,按照套路推一推就可以推出来了 注意其中有一步要用范德蒙德卷积 code: #include<bits/stdc++.h> # 阅读全文
posted @ 2021-12-17 08:44 lahlah 阅读(60) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P7323 考场上降大智了 首先发现如果$x->y,y->z$合法,那么$x->z$也一定合法 那么对于这样的同种颜色的两条边$y->x,z->x$,那么$z->y$一定合法 就可以把$z,y$合并 一路合并下去,再看看每个集合里有多 阅读全文
posted @ 2021-12-17 08:37 lahlah 阅读(35) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P7324 70分的DP非常好想和好写 我们其实不用关心具体的值是什么,只用关心相对大小 拿个真值表进去随便搞搞即可 code: #include<bits/stdc++.h> // 11 : < 12 : > 13 : ? #def 阅读全文
posted @ 2021-12-17 08:33 lahlah 阅读(43) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P4694 首先可以用$wqs$二分去掉$K$的那个限制 然后可以发现剩下的就是一个模拟费用流了 code: #include<bits/stdc++.h> #define ll long long #define N 500050 阅读全文
posted @ 2021-12-17 08:26 lahlah 阅读(64) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P6122 NB模拟费用流题 费用流的建图不难,我们考虑如何模拟这个过程 可以暴力模拟这个过程因为树的高度只有$log n$所以可以暴力去找增广路,然后暴力增广 维护一下每个点儿子中最近的关键点即可 然后记录一下每条边的流量和方向 c 阅读全文
posted @ 2021-12-17 08:13 lahlah 阅读(42) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P5631 类似SUM那题 挖掉某一块后看是否还是能构成生成树 考虑分治,用按秩合并并查集来维护联通性 code: #include<bits/stdc++.h> #define N 2000050 using namespace s 阅读全文
posted @ 2021-12-17 07:26 lahlah 阅读(51) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF678F 首先一眼线段树分治 然后线段树上每个节点建一个凸包,在上面三分即可 code: #include<bits/stdc++.h> #define ll long long #define N 300050 using na 阅读全文
posted @ 2021-12-17 07:20 lahlah 阅读(136) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P3545 模拟费用流入门题 能满足就满足 不能满足考虑反悔,替换掉前面一个$b_j$最大的,如果$b_j<b_i$那就没有必要替换 code: #include<bits/stdc++.h> #define N 250050 #de 阅读全文
posted @ 2021-12-16 22:06 lahlah 阅读(103) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P5470 模拟费用流硬分析讨论即可 具体看 https://djy-juruo.blog.luogu.org/solution-p5470 code: #include<bits/stdc++.h> #define N 200050 阅读全文
posted @ 2021-12-16 22:00 lahlah 阅读(30) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF1519E 可以考虑连边 \((\frac{a_i}{b_i}+1)-(\frac{c_i}{d_i})\) \((\frac{a_i}{b_i})-(\frac{c_i}{d_i}+1)\) 然后跑最大匹配 code: #inc 阅读全文
posted @ 2021-12-16 21:27 lahlah 阅读(55) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P3643 经典题 把范围离散化后转移可以做到$O(n^3)$ 方案数可以用用组合数计算 code: #include<bits/stdc++.h> #define mod 1000000007 #define N 2005 #def 阅读全文
posted @ 2021-12-16 20:57 lahlah 阅读(34) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF724E 模拟最小割nb题 首先可以轻易得到最大流的建图,每个点往后连边,大小为$C$,$S$向$i$连$p_i$,$i$向$T$连$s_i$ 因为最大流=最小割 考虑DP出最小割 设$f[i][j]$为考虑了前$i$个,有$j$ 阅读全文
posted @ 2021-12-16 20:45 lahlah 阅读(33) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF176E 非常重要的一个trick,我竟然不知道 首先把关键点拿出来,按照$dfs$序排后为 \(x_1,x_2,x_3,x_4,....,x_k\) 最小联通块大小$=\frac{1}{2}*(dis(x_1,x_2)+dis( 阅读全文
posted @ 2021-12-16 20:08 lahlah 阅读(93) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF1188D 奇妙DP题 https://www.luogu.com.cn/blog/RUI-R/solution-cf1188d 重点是要知道可以分别考虑每一位,按后几位排序后进位的一定是一个前缀,这样就可以优化状态数 code: 阅读全文
posted @ 2021-12-16 20:04 lahlah 阅读(40) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF704D 假设$r<c$ 首先肯定是建成二分图,通关简单分析可以知道每个点可以取的范围是 $[\frac{x-d+1}{2},\frac{x+d}{2}]$都是下取整 所以跑个上下界有源汇最大流即可 code: #include< 阅读全文
posted @ 2021-12-16 19:57 lahlah 阅读(48) 评论(0) 推荐(0)
摘要:阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴 阅读全文
posted @ 2021-12-15 13:16 lahlah 阅读(55) 评论(0) 推荐(0)
摘要:阿巴阿巴阿巴 阅读全文
posted @ 2021-12-15 12:09 lahlah 阅读(129) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/P6031 首先发现每次洗牌都是独立的,所以概率 ... 阅读全文
posted @ 2021-12-13 20:03 lahlah 阅读(45) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF605E 首先肯定对E排序 式子推出来这样 然后类似dijk... 阅读全文
posted @ 2021-12-10 11:19 lahlah 阅读(38) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF590E 本质上就是要求最长反链 首先可以用AC自动机建出一个... 阅读全文
posted @ 2021-12-10 11:13 lahlah 阅读(97) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF516D 注意到 ... 阅读全文
posted @ 2021-12-10 10:48 lahlah 阅读(67) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/AT4995 枚举最后移动到的那个点,然后考虑DP 设 ... 阅读全文
posted @ 2021-12-09 19:46 lahlah 阅读(80) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/AT5140 奇妙的构造题 首先发现 ... 阅读全文
posted @ 2021-12-09 07:12 lahlah 阅读(41) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/AT4994 考虑将曼哈顿距离的绝对值拆开,变成 又因为题目要求... 阅读全文
posted @ 2021-12-08 20:57 lahlah 阅读(83) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/AT4928 NB题,大受震撼 ... 阅读全文
posted @ 2021-12-07 07:41 lahlah 阅读(64) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/AT4927 ... 阅读全文
posted @ 2021-12-06 21:51 lahlah 阅读(80) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/AT4518 考虑如果有解,一定存在欧拉回路 那么所有点到度数一定... 阅读全文
posted @ 2021-12-06 20:19 lahlah 阅读(47) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/AT4514 往01中间插一根红线,10中间插一根蓝线,如上图 ... 阅读全文
posted @ 2021-12-06 19:50 lahlah 阅读(57) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/AT4505 考虑建图,每个集合连向集合内的点,连出一个二分图 得... 阅读全文
posted @ 2021-12-06 19:47 lahlah 阅读(37) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF755F 还是有点意思的这题 首先考虑少的,显然每个环先放 ... 阅读全文
posted @ 2021-12-04 08:13 lahlah 阅读(51) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF1439B ... 阅读全文
posted @ 2021-12-04 08:12 lahlah 阅读(32) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF1301F 因为 ... 阅读全文
posted @ 2021-12-04 08:11 lahlah 阅读(36) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF576D 不小心点了一下推荐题目,然后这题就会了 首先每条边按... 阅读全文
posted @ 2021-12-04 08:10 lahlah 阅读(66) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF1110F 考虑先把问题离线下来, 用线段树维护当前点到所有叶... 阅读全文
posted @ 2021-12-04 08:09 lahlah 阅读(31) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF1325E 有些启发性的题目 首先发现 ... 阅读全文
posted @ 2021-12-04 08:08 lahlah 阅读(36) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF741C 怎么在ZR做过两次的题还是没想出来,逊捏 考虑对于 ... 阅读全文
posted @ 2021-12-04 08:07 lahlah 阅读(30) 评论(0) 推荐(0)
摘要:https://www.luogu.com.cn/problem/CF464E 晚修结束前十分钟打开,想了一会没半点思路 杨队过来一... 阅读全文
posted @ 2021-12-04 08:03 lahlah 阅读(67) 评论(0) 推荐(0)
摘要:真实水平好吧 8说了,卷起来 ABC230G - GCD Permutation 考虑 ... 阅读全文
posted @ 2021-12-04 08:00 lahlah 阅读(90) 评论(0) 推荐(0)