摘要: #include #include #include #include #include #include #define maxn 100001 using namespace std; char s[maxn]; bool w[maxn]; int S[maxn],n,top,tt,T; bool pd(int l,int r) { for (int i=l;i<=r;i... 阅读全文
posted @ 2016-07-23 19:53 Yangjiyuan 阅读(245) 评论(0) 推荐(0) 编辑
摘要: #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #include<cmath> #include<queue> using namespace std; typed 阅读全文
posted @ 2016-07-23 19:52 Yangjiyuan 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 先按斜率排序,再将最小的两条线入栈,然后依次处理每条线,如果其与栈顶元素的交点在上一个点的左边,则将栈顶元素出栈 ; 阅读全文
posted @ 2016-07-23 19:51 Yangjiyuan 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; #define MAXN 100000000 #define prime1 9983543 #define prime2 9804799 #define MOD 99999971 #define N 1010 int m,n,A,B,q; ... 阅读全文
posted @ 2016-07-23 19:49 Yangjiyuan 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 若Y小于等于sqrt(300000),暴力,对所有的插入的数都更新mn[i]。 若Y大于sqrt(300000),枚举kY,用并查集维护>=i的第一个数,这样只支持删除操作是O(1),然后倒着枚举一边,删除一个数x那么就fa[x]=fa[x+1] 阅读全文
posted @ 2016-07-23 19:48 Yangjiyuan 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 一个大于b的数和一个小于b的数可以互相抵消,所以我们用1和-1表示。 从b向两边扩展,left[i]表示b左边抵消后有i个数比b小的可能数,right[i]表示b右边抵消后有i个数比b大的可能数。 ans=sigma(left[i]*right[i]). 阅读全文
posted @ 2016-07-23 19:46 Yangjiyuan 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 两次bfs可得直径,答案一定不会小于所有点到直径的距离最大值,只要把直径上的边权设为0,任选直径上一点bfs可得将最大值作为二分下界,二分直径左右端点的舍弃部分 阅读全文
posted @ 2016-07-23 19:45 Yangjiyuan 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 给白色边都加上一个值,二分这个值,使得选取的白边数量减少 阅读全文
posted @ 2016-07-23 19:39 Yangjiyuan 阅读(136) 评论(0) 推荐(0) 编辑