摘要: 链接:http://hihocoder.com/problemset/problem/1699 快毕业了的菜菜,做了个比赛,遇到四维偏序,调成了傻逼,所以记录下,看了下以前的傻逼代码,发现自己的cdq居然用sort 怪不得总是被卡常,然后就是套路cdq+cdq,这类题的坑点就是有相同的矩形 贴代码: 阅读全文
posted @ 2018-02-25 22:40 shuguangzw 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 分析:a^b+2(a&b)=a+b so->a^(-b)+2(a&(-b))=a-b 然后树状数组分类讨论即可 链接:http://www.ifrog.cc/acm/problem/1023 吐槽:这个题本来是mod(2^40),明显要用快速乘啊,但是用了以后狂T,不用反而过了,不懂出题人 #inc 阅读全文
posted @ 2016-09-08 13:48 shuguangzw 阅读(468) 评论(0) 推荐(0) 编辑
摘要: http://www.ifrog.cc/acm/problem/1028 题解处:http://www.ifrog.cc/acm/solution/4 #include <cstdio> #include <cstring> #include <queue> #include <cmath> #in 阅读全文
posted @ 2016-09-06 18:38 shuguangzw 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 1807: 最长上升子序列~ Description Bobo 在 ICPCCamp 学会了解决最长上升子序列问题后得到了一个长度为 n 的数列 p1,p2,…,pn. Bobo 想用 1,2,…,n 来替换其中值为 0 的元素,使得 p1,p2,…,pn 互不相同(即 p1,p2,…,pn 是 { 阅读全文
posted @ 2016-09-06 11:30 shuguangzw 阅读(399) 评论(0) 推荐(0) 编辑
摘要: 分析:根据这个题学了一发自适应simpson积分(原来积分还可以这么求),然后就是套模板了 学习自适应simpson积分:http://blog.csdn.net/greatwall1995/article/details/8639135 #include <cstdio> #include <cs 阅读全文
posted @ 2016-09-05 14:56 shuguangzw 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 分析:巧妙构图,记得某一次bc的最后一道题就是这个,就是借鉴这个老题吧,貌似很多题都是借鉴这个题 关键在于,倒着看是某个人倒数第几个修,这样只影响后面的人,跑费用流就好了 #include <iostream> #include <stdio.h> #include <string.h> #incl 阅读全文
posted @ 2016-08-31 18:39 shuguangzw 阅读(185) 评论(0) 推荐(0) 编辑
摘要: A:模拟水题不说 #include <iostream> #include <string.h> #include <algorithm> #include <stdio.h> #include <math.h> #include <bitset> using namespace std; type 阅读全文
posted @ 2016-08-30 15:38 shuguangzw 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 分析:每次找重心可以发现最多n层,每层复杂度是O(nlogn) 总体时间复杂度是O(nlog^2n) #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #in 阅读全文
posted @ 2016-08-15 22:16 shuguangzw 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 分析:两遍dfs的树形dp裸题,记录子树最长链,然后自顶向下更新即可。。。 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #include <queue> 阅读全文
posted @ 2016-08-15 15:48 shuguangzw 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 分析:典型的两遍dfs树形dp,先统计到子树的,再统计从祖先来的,dp[i][0]代表从从子树回来的最大值,dp[i][1]代表不回来,id[i]记录从i开始到哪不回来 吐槽:赛场上想到了状态,但是不会更新,而且据说这是一种典型的树形dp,还是太弱 #include <cstdio> #includ 阅读全文
posted @ 2016-08-15 14:45 shuguangzw 阅读(331) 评论(0) 推荐(0) 编辑