摘要: 01分数规划的基本裸题。 因为路线一定是个环,所以找个最优比率生成环即可 二分一个比值,check一下即可。 阅读全文
posted @ 2018-07-08 23:51 SWHsz 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 我真的是咸鱼啊 多少年前的基础了我竟然才弄明白,哭 用树状数组维护 using namespace std; mapmp; int f[50005],n,t[50005]; void modify(int x,int Max){ for(int i=x;i 阅读全文
posted @ 2018-07-08 21:48 SWHsz 阅读(766) 评论(5) 推荐(0) 编辑
摘要: 前置: nlogn逆序对: 前一个小时我还真的不会这个Orz 这里运用归并排序的思想。 对于一个序列,我们把它先分开,再合并成一个有序序列。 引自https://blog.csdn.net/qq_30189255/article/details/50937307 假设f(i,j)为i到j号元素中的逆 阅读全文
posted @ 2018-07-08 21:28 SWHsz 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 一直没有思路啊。。 看了下byvoid的解释,强啊 以下内容来自byvoid https://www.byvoid.com/zhs/blog/lpf24 solution 最大权不相交路径问题,可以用最大费用最大流解决。 【建模方法】 方法1 按左端点排序所有区间,把每个区间拆分看做两个顶点,建立附 阅读全文
posted @ 2018-07-08 19:04 SWHsz 阅读(172) 评论(2) 推荐(0) 编辑
摘要: 树链剖分LCA O(n) O(logn) cpp include include const int N=500005; int n,m,S,ecnt,head[N],tim; struct Edge{int to,nxt;}e[N=dep[top[y]]) x=fa[top[x]]; else y 阅读全文
posted @ 2018-07-08 18:41 SWHsz 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 看到一个dalao的博客,里面有很多神奇的东西。 https://www.czyhe.me/2018/05/05/strangaj lerta%C4%B5oj.html (这种博客会不会崩。。。) 阅读全文
posted @ 2018-07-08 17:35 SWHsz 阅读(192) 评论(2) 推荐(0) 编辑
摘要: 一道冒充网络流的最短路题。 根据题意,用位运算表示能否转移与转以后的状态。 (!($u$ & $cantinc$[i])) && (!($incw$[i] & $u$ ^ $incw$[i])) $u$表示旧状态,$cantinc$(can't include),$inc$(include wron 阅读全文
posted @ 2018-07-08 15:40 SWHsz 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 费用流Orz 懒癌发作复制了个mcf的模板 然后那个模板建边cost是不取反的,因此出现了负环,spfa出不来了,调试到心态爆炸Orz 建模:每个点向与它有相连的点连一条边权为1,cost为v的边,表示一个物品可取一次,再连一条边权inf,cost为0的边。 读题大赛,出题人语文水平堪忧。 cpp 阅读全文
posted @ 2018-07-08 11:58 SWHsz 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 在tyvj上怀疑爆栈了.....~~或许~~一定是我写挂了。以后调吧。。。 UPD:bzoj上过了。。。 题解:https://blog.csdn.net/popoqqq/article/details/39965603 po姐太神了! cpp include include include inc 阅读全文
posted @ 2018-07-08 10:23 SWHsz 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 突然发现这个自己还不会。。。 其实也不难,就和快速幂感觉很像,把物品数量二进制拆分一下,01背包即可 我是咸鱼 cpp include include include using namespace std; int a[7],ave,sum; bool f[120005]; void bag01( 阅读全文
posted @ 2018-07-08 08:55 SWHsz 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 做克鲁斯卡尔的时候维护一个并查集即可。 cpp include include include include using namespace std; const int N= 6010; int T; struct Edge { int x,y,val; } e[N]; bool operato 阅读全文
posted @ 2018-07-08 02:04 SWHsz 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 滚动数组优化一波。 原设计状态:表示三个员工分别的位置和执行到的任务。 考虑到:执行完第i个任务,一定有员工在pos[i],那么就可以压一维,空间复杂度就算不滚动数组也可以了。 (喜闻乐见,~~今天~~第一次)1A cpp include include include using namespac 阅读全文
posted @ 2018-07-08 01:14 SWHsz 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 对的$n^3$的程序调了一个月了,惊了。。。 HSZ学oi$\Longleftrightarrow$闭眼学oi 要不是翻旧账还看不见。。 这是有$n^2$做法的。 参见LYD的书P244 cpp include include include include include include defi 阅读全文
posted @ 2018-07-08 00:25 SWHsz 阅读(131) 评论(0) 推荐(0) 编辑