2018年3月8日

洛谷2142高精度减法(模板)

摘要: 题目:https://www.luogu.org/problemnew/show/P2142 阅读全文

posted @ 2018-03-08 00:19 Narh 阅读(162) 评论(0) 推荐(0) 编辑

2018年3月7日

bzoj1853幸运数字

摘要: 题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1853 容斥原理的应用。 发现十位的话只有2047个只含6或8的数,故可以存。它们的倍数个数只要到时候用边界除以一下就行了。 但容斥原理是指数级别的。故剪枝: 因为比 r 大的 lcm 就没用了。 阅读全文

posted @ 2018-03-07 23:21 Narh 阅读(163) 评论(0) 推荐(0) 编辑

POJ2411骨牌覆盖——状压dp

摘要: 题目:http://poj.org/problem?id=2411 状压dp。注意一下代码中标记的地方。 阅读全文

posted @ 2018-03-07 00:15 Narh 阅读(155) 评论(0) 推荐(0) 编辑

2018年3月6日

tyvj1035棋盘覆盖——二分图匹配

摘要: 题目:http://www.joyoi.cn/problem/tyvj-1035 把可放的位置作为节点,相邻的连边。 可用天然有的编号作为节点的编号。 果然只用连单向边就行了。也只需记录另一部的对应点。 注意易写错的那个地方。 阅读全文

posted @ 2018-03-06 22:40 Narh 阅读(150) 评论(0) 推荐(0) 编辑

洛谷3386二分图模板

摘要: 题目:https://www.luogu.org/problemnew/show/P3386 注意代码中标记处。 阅读全文

posted @ 2018-03-06 19:13 Narh 阅读(119) 评论(0) 推荐(0) 编辑

2018年3月5日

洛谷1020导弹拦截

摘要: Dilworth定理的证明:http://www.cnblogs.com/nanke/archive/2011/08/11/2134355.html 感觉难理解。有空研究。 阅读全文

posted @ 2018-03-05 23:14 Narh 阅读(117) 评论(0) 推荐(0) 编辑

2018年3月1日

bzoj2467生成树

摘要: 题目:http://www.lydsy.com/JudgeOnline/problem.php?id=2467 大水题。 #include<iostream> #include<cstdio> using namespace std; typedef long long ll; const int 阅读全文

posted @ 2018-03-01 15:43 Narh 阅读(92) 评论(0) 推荐(0) 编辑

2018年2月28日

POJ1631 LIS模板

摘要: 题目:http://poj.org/problem?id=1631 两种nlogn的方法。 1.树状数组优化暴力。有种扫描线的感觉,以时间保证位置,把值作为数组脚标。 2.记录长为...的上升子序列末尾元素最小值;如果新入元素a比d [ top ]大,就d [ ++top ] = a,否则二分查找第 阅读全文

posted @ 2018-02-28 21:09 Narh 阅读(92) 评论(0) 推荐(0) 编辑

寒假培训之 test 2

该文被密码保护。 阅读全文

posted @ 2018-02-28 17:02 Narh 阅读(11) 评论(0) 推荐(0) 编辑

POJ2299逆序对模板(树状数组)

摘要: 题目:http://poj.org/problem?id=2299 只能相邻两个交换,所以交换一次只会减少一个逆序对。所以交换次数就是逆序对数。 ps:原来树状数组还可以记录后边lowbit位的部分和。见代码。 阅读全文

posted @ 2018-02-28 16:50 Narh 阅读(96) 评论(0) 推荐(0) 编辑

导航