摘要: #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <queue> using namespace std; const int N = 1 阅读全文
posted @ 2018-12-19 22:08 lqsno1 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 不知道最大子矩阵跟贪心有什么关系。。。 写过好多次了gugugu。贴一个网上贪心的题解。。。O(n^2)的悬线,单调栈不好吗。。。 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int a[20 阅读全文
posted @ 2018-12-19 21:36 lqsno1 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 答案有可能为负的。。。wa了好几发。 #include<iostream> #include<algorithm> using namespace std; typedef long long ll; const int N=50005; typedef pair<ll,ll> P; P a[N]; 阅读全文
posted @ 2018-12-19 21:28 lqsno1 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 看错题了无语。。。还以为只要在一排并且每个位置最多为1个士兵就可以。。。 原来是(x,y), (x+1,y), ..., (x+N-1,y), y取中点,x先减i,再去中点。 就是贪心~ #include<iostream> #include<algorithm> using namespace s 阅读全文
posted @ 2018-12-19 20:55 lqsno1 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 二分+离散化+前缀和好像过不了。。。就先gu了。 只能拿70分。 #include<bits/stdc++.h> using namespace std; vector<int>v; int get_id(int x){return lower_bound(v.begin(),v.end(),x)- 阅读全文
posted @ 2018-12-19 20:09 lqsno1 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 平面最近点对,以后再也不用vector了!会t。。。 #include<iostream> #include<algorithm> #include<vector> #include<cmath> using namespace std; const int N=200010; const doub 阅读全文
posted @ 2018-12-19 18:24 lqsno1 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 二分,只有有奇数 个防具的位置有破绽,但是整条防线上也最多只有一个位置有奇数个防具 为突破点,如果一个区间总共有奇数个防具那么可定就有有一个点的防具为奇数。 #include<bits/stdc++.h> using namespace std; typedef long long ll; cons 阅读全文
posted @ 2018-12-19 12:42 lqsno1 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 无脑枚举题。。。 #include<iostream> using namespace std; int t[5]; int get_(int x){ int r=0; while(x>0){ if(x&1)++r; x>>=1; } return r; } void pr(int x){ for( 阅读全文
posted @ 2018-12-19 12:14 lqsno1 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 贪心 #include<bits/stdc++.h> using namespace std; const int N=2505,inf=999999999; typedef pair<int,int>P; P a[N],b[N]; bool cmp1(const P&a,const P&b){ r 阅读全文
posted @ 2018-12-18 20:28 lqsno1 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 复习。。。 #include<bits/stdc++.h> using namespace std; const int N=1e5+5; int lg[N],f[N][20]; inline int get_max(int l,int r){ int t=lg[r-l+1]; return max 阅读全文
posted @ 2018-12-17 21:33 lqsno1 阅读(104) 评论(0) 推荐(0) 编辑