摘要: 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 阅读(106) 评论(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 阅读(32) 评论(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 阅读(59) 评论(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 阅读(36) 评论(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 阅读(34) 评论(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 阅读(95) 评论(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 阅读(41) 评论(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 阅读(49) 评论(0) 推荐(0)