自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 匈牙利算法

什么是二分图,什么是二分图的最大匹配,这些定义我就不讲了,网上随便都找得到。二分图的最大匹配有两种求法,第一种是最大流(我在此假设读者已有网络流的知识);第二种就是我现在要讲的匈牙利算法。这个算法说白了就是最大流的算法,但是它跟据二分图匹配这个问题的特点,把最大流算法做了简化,提高了效率。匈牙利算法其实很简单,但是网上搜不到什么说得清楚的文章。所以我决定要写一下。最大流算法的核心问题就是找增广

2014-08-31 10:32:45 565

转载 Network Planning

Network PlanningTime Limit: 1000ms, Special Time Limit:2500ms,Memory Limit:65536KBTotal submit users: 12, Accepted users:10Problem 12930 : No special judgementProblem descr

2014-08-27 00:58:30 601

转载 HDU1542

//我的理解是他把y由低到高的分布建树,共建m个点,即y点的分布个数,当该点为起始点即cover>0时则加入//计算面积,否则继续更新,为-1时则表示不可加入计算面积//按y的分布来建树,对于每一“单位”区间的y距离,记录他的x坐标,covered>0时可加入计算 //方法很巧的矩形并的面积#include#include#include //A #define maxn 410u

2014-08-27 00:55:29 457

转载 DVDs

DVDsTime Limit: 1000ms, Special Time Limit:2500ms,Memory Limit:65536KBTotal submit users: 13, Accepted users:6Problem 12935 : No special judgementProblem descriptionD

2014-08-27 00:55:21 598

转载 POJ3468

#include//思路要详解 ,不能废题 #include//A了 #define ll __int64#define maxn 100010using namespace std;struct NOde{ ll l,r,ad,value;}tree[maxn*4];void pushup(ll root){ tree[root].value=tree[root<<1].

2014-08-27 00:54:41 370

转载 Road

RoadTime Limit: 1000ms, Special Time Limit:2500ms,Memory Limit:65536KBTotal submit users: 23, Accepted users:20Problem 12934 : No special judgementProblem description

2014-08-27 00:53:49 374

转载 Enterprising Escape

Enterprising EscapeTime Limit: 20000ms, Special Time Limit:50000ms,Memory Limit:65536KBTotal submit users: 28, Accepted users:18Problem 12921 : No special judgementProblem

2014-08-27 00:50:07 432

转载 蒲丰投针问题

蒲丰投针问题这一方法的步骤是:1) 取一张白纸,在上面画上许多条间距为a的平行线。2) 取一根长度为l(l3)计算针与直线相交的概率.18世纪,法国数学家布丰和勒可莱尔提出的“投针问题”,记载于布丰1777年出版的著作中:“在平面上画有一组间距为a的平行线,将一根长度为l(lp=2l/(πa)π为圆周率

2014-08-27 00:48:59 3500

转载 HDU4978

#include#include//用了double型的凸包模版就华丽丽的A了 #include#include#define PI acos(-1.0)using namespace std;const double eps = 1e-6;int sgn(double a) { return (a>eps) - (a<-eps);}struct point{ d

2014-08-27 00:48:32 493

转载 HDU4971

#include#include#include#include#include#define maxn 10010#define INF 9999999//过了,一个是建图的思想,要想到是最大权闭合图,一个是模版,要套用好的模版,不断精进 using namespace std;struct EDGE{ int u,v,cap,next;}edge[maxn];int

2014-08-27 00:47:54 407

转载 HDU4972

#include//为什么是ans++,而不是2^ans? #include//用printf而非cout #include#define maxn 100010//一堆手误,还要判断输入是否合理不合理则输出0,表再手误了!!! #define ll intusing namespace std;//首先应该模拟几组数据试试,打个表什么的。。。。先找规律啥的 ll a[maxn];i

2014-08-27 00:46:38 444

转载 HDU4966详解

#include //这是别人的题解 #include #include #include #include //不过这道题为什么要达到所有点,不是只要有最高等级的点就行了么? using namespace std;/** 最小树形图* 复杂度O(NM)* 点下标[0,n-1] 边下标[0,m-1]* 有向边表示:u->v 花费为cost* 返回最小树形图的边权和,-1表示

2014-08-27 00:45:24 521

转载 HDU4966

#include //这是别人的题解 #include //A了 #include #include #include using namespace std;const int INF = 100000000;const int MAXN = 1010; //点数const int MAXM = 1010000;//边数struct EDGE{ int u,v,cost;

2014-08-27 00:44:04 396

转载 海报详解

#include#include#include#define N 10010struct node{ int x1,x2;}s[N];int vis[N],st[2*N],str[4*N],ys,count;struct node1{ int l,r; int cp;//标记该节点是否被某张海报完全覆盖}tree[16*N];//在添加顶点之后,最

2014-08-27 00:42:51 396

转载 海报

#include#include#include#define maxn 200002#define ll __int64//线段树入门作,执行更改某个值,找到区间最大值的操作 using namespace std;ll num[maxn];struct node{ ll max,l,r;}tree[maxn*20];ll build(ll root,ll left,ll

2014-08-27 00:42:01 397

转载 HDU1754

#include#include#include#define maxn 200002#define ll __int64//线段树入门作,执行更改某个值,找到区间最大值的操作 using namespace std;ll num[maxn];struct node{ ll max,l,r;}tree[maxn*20];ll build(ll root,ll left,ll

2014-08-27 00:40:36 406

转载 A+B

A+BTime Limit: 10000ms, Special Time Limit:25000ms,Memory Limit:65536KBTotal submit users: 19, Accepted users:4Problem 12899 : No special judgementProblem description

2014-08-27 00:37:24 710

原创 Battleship

#include//题意看错了,尼玛逗我。。。下次好好看题意啊,细致翻译 #includeusing namespace std;int a[100][100];char str[100][100];int main(){ int x,y; for(int i=1;i<=10;i++) { for(int j=1;j<=10;j++) { cin>>a[i][j];

2014-08-27 00:36:54 487

原创 Aztec Pyramid

Aztec PyramidTime Limit: 2000ms, Special Time Limit:5000ms,Memory Limit:262144KBTotal submit users: 60, Accepted users:53Problem 12905 : No special judgementProblem descrip

2014-08-27 00:33:01 615

转载 Chemistry

#include#define ll __int64ll a[51];int main(){ a[0]=0;a[1]=1;a[2]=1;a[3]=1;a[4]=2;a[5]=3;a[6]=5;a[7]=9;a[8]=18;a[9]=35;a[10]=75;a[11]=159;a[12]=355;a[13]=802;a[14]=1858;a[15]=4347;a[16]=1

2014-08-27 00:32:57 553

转载 Russian Dolls

Time Limit: 2000ms, Special Time Limit:5000ms,Memory Limit:65536KBTotal submit users: 12, Accepted users:9Problem 12895 : No special judgementProblem descriptionMaybe you

2014-08-27 00:29:15 496

转载 Red John Game

//详求原理,有点模糊,L形相消,因为%3为1则为一个点,为2则可化为2个点,则不被3整除即可//一堆规律题啊 //1+3*k=n*n,不能让她往外走,要让她往内走 #include#include#includeusing namespace std;int main(){ __int64 n; while(scanf("%I64d",&n)!=EOF) { if(n

2014-08-27 00:26:34 555

转载 最小割理论

转自mjmjmtl大牛:一、基本问题:1.到底什么是割:原始点集为V,选出一些点集S使得s∈S,T=V-S,t∈T,则S到T的边为S到T割,记做[S,T]。2.什么是最小割:图中所有的割中,边权值和最小的割为最小割!3.割得容量容量和流量计算的区别:割[S,T]的容量为∑(边(u,v)的容量和),其中u∈S,∈T。也就是说割的容量不计算反向的边!!而流量为正向的和反

2014-08-22 10:43:45 504

转载 最大权闭合图理论讲解

[网络流]最大权闭合图(转载)来自: http://hi.baidu.com/%C6%AE%BB%A8%C4%EA%B4%FA/blog/item/45d4bb1765e7044721a4e960.html以下内容参考 胡伯涛 《最小割模型在信息学竞赛中的应用》,感谢他为我们提供这么优秀的论文。看不懂以上论文的同学,可以试试看一下以下内容,本文无大量的数学符号,方便阅读理解。 

2014-08-22 10:34:44 481

转载 tarjan算法

/* 其实,tarjan算法的基础是DFS。我们准备两个数组Low和Dfn。Low数组是一个标记数组,记录该点所在的强连通子图所在搜索子树的根节点的Dfn值(很绕嘴,往下看你就会明白),Dfn数组记录搜索到该点的时间,也就是第几个搜索这个点的。根据以下几条规则,经过搜索遍历该图(无需回溯)和对栈的操作,我们就可以得到该有向图的强连通分量。 数组的初始化:当首次搜索到点p时,Dfn与

2014-08-21 18:59:54 378

转载 tarjan算法

说到以Tarjan命名的算法,我们经常提到的有3个,其中就包括本文所介绍的求强连通分量的Tarjan算法。而提出此算法的普林斯顿大学的Robert E Tarjan教授也是1986年的图灵奖获得者(具体原因请看本博“历届图灵奖得主”一文)。       首先明确几个概念。强连通图。在一个强连通图中,任意两个点都通过一定路径互相连通。比如图一是一个强连通图,而图二不是。因为没

2014-08-21 18:55:50 388

转载 最小树形图

个人觉得这个博客把这个算法说的比较详细了,直接搬过来吧,我再阐述一遍的话没有人家说的好,还容易说错。========================== 分割线之下摘自Sasuke_SCUT的blog==================================================最 小树形图,就是给有向带权图中指定一个特殊的点root,求一棵以root为根的有向生成树T

2014-08-19 23:50:55 337

转载 HDU4952

/*题意:给你一个数x,给你K次操作,每一次x变为大于等于 x 且是 i 的倍数的数。解题思路:可以知道  如果 变化以后  x 是i 和 i+1 的公倍数的倍数的话,那么x的值是不会变的,x  所以我们只需要枚举到前面那种情况就可以了。因为当i*(i+1)>x时,以后的每一步x都要变,于是就直接不变用来变最后一步x/i*k;*/#include#include#define

2014-08-15 23:55:29 425

原创 校赛4

Thread Tree Nathan O. Davis has been running an electronic bulletin board system named JAG-channel. He is now having hard time to add a new feature there --- threaded view. Like many other bul

2014-08-15 23:53:42 411

转载 校赛3

题意,给定一个函数,由yqiux

2014-08-15 23:52:15 331

转载 HDU4869

/*瞎搞+逆元快速幂)*/题解上写的也算比较清晰:最终的结果一定是连续出现的,只需要求出最终的区间。因为如果对同一张牌进行两次操作,牌的状态不改变。故牌的翻转次数一定是减少偶数次。如果所有数的和是奇数,那么最终结果也一定是奇数。同理,偶数也是一样的。所以只要递推求出最后的区间,计算sum(C(xi,m)(i=0,1,2。。。)),m是总牌数,xi是在区间内连续的奇数或偶数,在模10^9

2014-08-15 23:50:22 443

转载 HDU4912

#include#include#include//注意bfs,a了,但原理不明,模版未当 #include //hdu4912#define N 100010using namespace std;//我还没定义、。。。 struct Edge{ int from,to,nex;}edge[2*N];struct node{ int l,r; int lca;}q[N

2014-08-15 23:48:49 634

转载 校赛2

//以后记得要用2进制做题 #include//我的i代码 ,POW函数还是自己写好了。。。虽然弱多了,主要就是要想到二进制吧。。//素数打表要学着 #include#include#include#include#include#define ll __int64using namespace std;ll m;ll result[32000];ll tip;bool

2014-08-15 23:45:56 400

转载 HDU4912注解

#include"cstdio"#include"iostream"#include"set"#include"queue"//hdu4912#include"string.h"using namespace std;#define N 100010//由最下面的开始选,这样尽量多的选而且不重复,样例2中不是4,5,而是4,2,5, struct Edge{//样例二中,不是6,7

2014-08-15 23:41:41 393

转载 HDU4925

#include#include#includeusing namespace std;int map[102][102];int t;int main(){ scanf("%d",&t); while(t--) { int ans=0; int n,m; cin>>n>>m; if(n

2014-08-15 23:40:57 408

转载 HDU4891

#include//不要考虑{}¥相套的情况#include//尽量找简便的思路,A了 #include#include #include #include #define large 1003#define maxn 100000using namespace std;int n,flag,tip;char str[large][5000];__int64 time,r

2014-08-15 23:39:51 398

转载 HDU4901

#include//变量名坚决不要重名!!! ,直接递归到1023即可,不必搞那么麻烦一个一个记录 #include//A了,但为什么不明白。。???? #include#include#define large 1111const __int64 maxn=1e9+7;//memset一定要有using namespace std;__int64 a[large];__int64

2014-08-15 23:36:48 386

转载 校赛1

t#include#include#include#include#define ll __int64using namespace std;ll num[1000001];ll start,bad,stop,result;int main(){// memset(num,0,sizeof(num)); for(int i=1;i<=1000000;i++)//求因数相

2014-08-15 23:33:01 349

转载 HDU4941

#include//map函数大大 #include//大int是能放1e9的。。。学到了 ,A了 #include#include#define maxn 100010 using namespace std; struct node{ int x;int y;int c;}l[maxn]; map > fmap;//定义格式要学会 maphashx;maphashy;

2014-08-15 23:27:55 450

转载 HDU4940

//看了思路,还没有看代码,说是什么最小割,无源无汇可行流//输入u,v,d,b,d我,d+b敌,s到t,都要看方向,x为d和,y为d+b和,要找x>y,首先t集合只有一个元素,//因为如果有两个,跑走一个则y变小,注意s和t互为补集 ,大水题,有推理的思路就行了 ,重在思考 #include#include#define ll __int64using namespace std;

2014-08-15 23:25:26 653

空空如也

空空如也

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

TA关注的人

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