自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 poj2464 Brownie Points II

题意:在平面直角坐标系中给你N个点,stan和ollie玩一个游戏,首先stan在竖直方向上画一条直线,该直线必须要过其中的某个点,然后ollie在水平方向上画一条直线,该直线的要求是要经过一个stan之前画过的点。 这时候平面就被分割成了四块,两个人这时候会有一个得分,stan的得分是平面上第1、3象限内的点的个数,ollie的得分是平面上第2、4象限内的点的个数,在统计的时候在所画线上的点都不

2015-04-05 01:57:01 499

原创 hdu3642 Get The Treasury

题意:给一些长方体,求这些长方体相交2次以上的体积思路:在做过两维的之后做这个其实是一样的思路,先把z(第三维)处理了,然后在各个平面上面做扫描线(这里就和两维的一样了)#include#include#include#include#define LL __int64using namespace std;const int maxn = 1010;struct haha{

2015-04-04 00:41:09 357

原创 CF519E - A and B and Lecture Rooms

题意:给出一颗n个节点的树,有m次查询,每次查询求有多少个点到a、b的距离相等(1思路:树链剖分,可以看出有答案就是这条链的节点个数为奇数(链的长度为偶数)            主要就是找到a和b的LCA,还有a到b路径上的中点(mid),及中点偏向a的节点(midA)和中点偏向b的节点(midB) 这3个节点,分3种情况即可    size[i] 表示子节点和本身的节点数 dep[

2015-03-01 14:16:50 596

原创 BZOJ 3295 动态逆序对

题意:给定一个包含1~n的序列(不含重复数),求删除一个数前的逆序对数思路:我看我的代码,这用的应该是树状数组套线段树,原意是主席树,但是根本没有重用任何节点。            树状数组用于区间查询,线段树用于维护这些数。#include#include#define LL long longconst int maxn = 1e5+10;const int maxe =

2015-02-26 23:28:20 369

原创 hdu5002 LCT

思路:LCT要得到路径,就要维护rt,p,c要维护路径上的增值,就要维护inc要设置路径上的值,就要维护same和inc(注意和上面同时出现的时候这种情况,WA了我很多发这里)要维护路径上的严格次大值及其数量,就要维护最大值及其数量。。(这东西真麻烦)弱菜用了好久才能AC,看似模板题,代码一长就容易写挫了。。#include#include#define ls c[x]

2015-02-21 23:14:16 379

原创 ZOJ2112 线段树+splay

这题之前用指针的splay来写,各种无力各种爆内存,真是受不了今天改了一下splay的写法,一下就AC了更新的方法就是把线段树上的线段包含这个点的都更新(先删掉,再添加)(log^2n)查第k小就是二分比t小的数的个数,寻找刚好大于等于k的那个数(log^3n)#include#include#include#define lson l,m,rt<<1#define rso

2015-02-18 00:11:32 311

原创 HDU 1890 Robotic Sort

试水splay思路:把需要排的的节点splay到根(预处理保存这些节点),就可得到答案(左子树节点的数量)            更新的时候就是把当前序列第ith个节点splay到根,刚需要排的节点splay到根的右子树,跟新根的右子树的左子树题外话: 一开始写的时候傻了,硬是自己去找到当前要排序的节点,然后splay到根。 还有自己写的一些函数忘记pushdown了。。。#inc

2015-02-10 01:14:47 348

原创 BZOJ1500 [NOI2005]维修数列

初看这道题,被吓到了....思路就不多说了,已经很多人研究过这道题。参考的博客:https://www.byvoid.com/blog/noi-2005-sequence/http://www.cnblogs.com/kuangbin/archive/2013/08/28/3287822.html#include#includeusing namespace std

2015-02-06 15:07:06 499

原创 codechef JAN15 SEALCM

题意:在形如A[1],A[2],...,A[N](A[i]为整数且1最小公倍数(LCM)能被D整除的数组的个数。请你对满足L数据范围:1            1                    1解题思路:容斥,对于每一个D,先把D质数分解,分解时把相同的合并起来,就是D=p1^a1*p2^a2...pn^an              然后再用总的

2015-01-13 14:32:58 413

原创 zoj3232 It's not Floyd Algorithm

题意:给出一个有向图的传递背包,求原图最少的

2014-05-04 16:13:54 454

原创 POJ 2892 Tunnel Warfare

题意:D x 表示摧毁一个村庄

2014-05-04 15:57:26 423

转载 2-sat总结

2-SAT问题 :N个集合,每个集合中有两个元素xi,yi,选且只选一个元素。不同集合间的元素可能不能同时被选中。 然后或者判定是否存在可行解,或者存在的话,求出一组可行解。k-SAT(k>=3)的话,就是NP问题了。还是很容易想到建图上去的。元素作为点,如果选择元素a,必须选择元素b的话,就连一条有向边。那么一个强连通分量里面就是,如果选择其中任何一个点,

2013-12-20 20:11:58 555

原创 csu1327

模拟题,被负数坑了。。#include#include#include#include#include#include#include#include#includeusing namespace std;char s[20];int main(){ int X,T; scanf("%d",&T); while(T--) { scanf("%d",&X)

2013-10-05 00:41:46 563

原创 csu1326

背包的分组问题,详见背包九讲用并查集分组、。、#include#include#include#include#include#include#include#include#includeusing namespace std;#define N 1005int F[N], vis[N];int W[N], P[N];int dp[N];vectors[N

2013-10-05 00:40:06 605

原创 csu1323

n为M二进制保留最高位,分开2部分来异或,大于等于n的 和 小于n的。#include#include#include#include#include#include#include#include#includeusing namespace std;int batt[100005];int main(){ int N,M; while(sc

2013-10-05 00:36:38 717

原创 csu1318

#include#include#include#include#include#include#include#includeusing namespace std;int main(){ int V; while(scanf("%d",&V)!=EOF) { int ans=0; while(V>0)

2013-10-05 00:04:00 690

原创 csuoj1321

最短路#include#include#include#include#include#include#include#include#includeusing namespace std;const int maxn=10005;#define mod 1000000007long long ans[maxn];void init(){ ans[0]=

2013-10-05 00:02:47 590

原创 csuoj1320

卡特兰数#include#include#include#include#include#include#include#include#includeusing namespace std;const int maxn=10005;#define mod 1000000007long long ans[maxn];void init(){ ans[

2013-10-05 00:00:38 526

原创 选拔3 1006

博弈,不知道对不对#include#include#include#include#include#include#includeusing namespace std;int s[30],N;void change(int x,int y){ for(int i=x;i<=y;i++) s[i]=3-s[i];}int dfs(){ int count=

2013-09-27 13:07:19 675

原创 选拔3 1005

#include<cstdio>#include<iostream>#include<cstring>#include<string>#include<vector>#include<algorithm>#include<time.h>const __int64 inf=(__int64)1<<31;using namespace std;int ans[1100000];__int64 pr[20];__int64 t[20];__int64 p[20];int n;int m

2013-09-26 23:29:08 559

原创 poj1185炮兵阵地

题意:P放炮兵,前后左右不能放,求最多能放多少思路:状态压缩dp#include#include#include#define max(a,b) (a>b?(a):(b))using namespace std;int sum[65],num[65];int dp[105][65][65];int map[105];int cnt;int check(int n){ if(n

2013-09-04 22:04:07 453

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除