上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 46 下一页
摘要: 7.30 DP 凸相关 决策单调性、斜率优化、凸、四边形不等式,都是凸相关。 前置知识 四边形不等式:交叉小于包含。\(l_1<l_2<r_1<r_2\to w(l_1,r_1)+w(l_2,r_2)\leq w(l_1,r_2)+w(l_2,r_1)\)。 区间包含单调性:包含区间值单调。\(l_ 阅读全文
posted @ 2023-07-30 18:26 caijianhong 阅读(121) 评论(0) 推荐(0)
摘要: 7.29 数论 扩欧、中国剩余定理、乘法逆元、卢卡斯定理、BSGS、阶和原根的英文名分别是 exGCD, exCRT, Inverse, Lucas, BSGS, Primitive root。 \(a\equiv b\pmod p\Rightarrow \frac{a}{d}\equiv \fra 阅读全文
posted @ 2023-07-29 11:55 caijianhong 阅读(67) 评论(0) 推荐(0)
摘要: ## problem 一只青蛙,他会跳,现在要从 $1$ 跳到 $n$。跳一次有 $m$ 种跳法,假设现在在 $x$,那么第 $i$ 次可以从 $x$ 跳到 $x+d_i$,同时消耗 $p_j$ 的能量。问你有多少种跳的方案使得消耗能量不超过 $k$。$n\leq 10^9,m\leq 10^5,1 阅读全文
posted @ 2023-07-28 16:19 caijianhong 阅读(57) 评论(0) 推荐(0)
摘要: 长链剖分优化 DP 板子题了,但是虽然是板子这个转移方程也很难想。 problem 输入一棵 \(n\) 个点的树。求 \[\sum_{1\leq i<j<k\leq n}[dist(i,j)=dist(i,k)=dist(j,k)] \]\(n\leq 10^5\)。 solution \(O(n 阅读全文
posted @ 2023-07-25 21:56 caijianhong 阅读(61) 评论(0) 推荐(0)
摘要: ## problem 一棵树边带正整数权,给出所有 $dis(i,i+1)$,还原树的边权,或者无解。$n\leq 10^5,V\leq 10^{12}$。 ## solution 首先很容易得到 $n$ 个方程形如 $dep_1=0,dep_i+dep_{i+1}-2dep_{lca(i,i+1) 阅读全文
posted @ 2023-07-25 16:17 caijianhong 阅读(37) 评论(0) 推荐(0)
摘要: 特别鸣谢: ## problem 两个数组 $a,b$ 长度分别为 $n,m$。将 $b$ 的所有元素以任意顺序插入 $a$ 的任意位置,使最终序列逆序对数量最小,并输出这个值。$n,m\leq 10^6$。 ## solution $b$ 明显是排序成不降的最优,$a$ 原来的逆序对个数无法改变, 阅读全文
posted @ 2023-07-25 15:54 caijianhong 阅读(38) 评论(0) 推荐(0)
摘要: ## Problem 随机 $n$ 个正整数组成序列。将序列分尽量多的段数,使得前一段的和不大于后一段的和。求能分成多少段。输出 $n-ans$。$n\leq 10^5$,值域不重要。 ## Solution 状态设计为:$f_i=1+\min_{sum_i-sum_j\geq g_j}f_j$ 表 阅读全文
posted @ 2023-07-25 14:36 caijianhong 阅读(21) 评论(0) 推荐(0)
摘要: posted on 2021-03-20 08:26:53 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/320621) 看数据范围,$1\leq T\leq10^4$,$1\leq n\leq 10^9$,显然是构造题。 我们分 阅读全文
posted @ 2023-07-25 12:31 caijianhong 阅读(27) 评论(0) 推荐(0)
摘要: posted on 2021-03-20 09:09:40 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/320635) 2023 编者注:有一些链接点不进去,分别是 [CF1497C1](https://codeforces.c 阅读全文
posted @ 2023-07-25 12:31 caijianhong 阅读(33) 评论(0) 推荐(0)
摘要: posted on 2021-03-13 21:57:02 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/319230) 简单模拟题,考验选手的读题能力~~和使用谷歌翻译的能力~~。 先定义一个 $now=0$,我们最后算出来的结 阅读全文
posted @ 2023-07-25 12:30 caijianhong 阅读(10) 评论(0) 推荐(0)
摘要: posted on 2021-03-16 17:42:06 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/319814) 题目可以转化一下:给一个长为 $n$ 的数组 $a$,请求出一个长为 $n$ 的数组 $b$。要求若 $a_ 阅读全文
posted @ 2023-07-25 12:29 caijianhong 阅读(27) 评论(0) 推荐(0)
摘要: posted on 2020-11-12 17:25:10 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/287646) 2023 编者注:请尊重历史。 # 本题正解是暴力枚举 先引用我们老师的一句话:(**无恶意**) >不会吧 阅读全文
posted @ 2023-07-25 12:28 caijianhong 阅读(750) 评论(0) 推荐(0)
摘要: posted on 2020-11-14 10:00:20 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/288276) 2023 编者注:本篇题解的方法过于暴力,但是尊重历史。请不要太在意。 —- # 教你们用栈做这道题 [原题 阅读全文
posted @ 2023-07-25 12:26 caijianhong 阅读(241) 评论(0) 推荐(0)
摘要: posted on 2021-02-05 12:19:34 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/310534) 这道题有一个很坑的地方: >差不够四位数时补零。 但实际上我们并不需要补零。举个例子,$45$ 是这样变化的 阅读全文
posted @ 2023-07-25 12:24 caijianhong 阅读(198) 评论(0) 推荐(0)
摘要: posted on 2021-06-01 13:24:05 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/337514) 给 $0\cdots9$ 每个数字打表,打它在相应的位置有没有一划。 然后把每个数字分成 $5$ 部分,暴力 阅读全文
posted @ 2023-07-25 12:22 caijianhong 阅读(10) 评论(0) 推荐(0)
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 46 下一页