自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

liwei的专栏

记录生活与学习的点点滴滴

  • 博客(29)
  • 收藏
  • 关注

原创 USACO各种思想好题归纳

Section 1.1PROB Broken Necklace这里也是巧解……/*ID:liwei101PROG:beadsLANG:C++*/#include #include #include #include #include #include #include #include #include #include #

2014-02-25 19:51:58 1254

原创 POJ 3469最大流最小割原理(Dinic多路增广)

这题有点神了,TLE了好多发啊!!!Dinic这T得无语了!后面实在不行看别人博客了!原来Dinic还有多路增广这做法,太神了!!!就是在dfs的时候多路增广……好神……做为网络流更快的模板了……再学习下sap优化就差不多了……#include #include #include #include #include #include #include #include #i

2014-02-23 18:50:15 1641

原创 USACO:test文件提交方法

/*PROG:rideLANG:C++ID:liwei101*/#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define PI acos(-1.0)#

2014-02-23 11:38:01 1758

原创 CF:375B - Maximum Submatrix 2 不太像DP(sort的升序快速方法)

题意:求最小的子矩阵中含1个数最多的子矩阵。思路:这题也看了好久,反正就是统计长和宽的1的个数,不过因为可能1如果在同一列,但是行不接近的这种情况得处理,所以……就是统计行的1的个数以后再排序嘛……#include #include #include #include #include #include #include #include #include #includ

2014-02-22 21:38:54 1071

原创 CF:Problem 383D - Antimatter 分治DP

D. Antimattertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIahub accidentally discovered a secret lab. He

2014-02-22 16:51:53 1126

原创 CF:Problem 394A - Counting Sticks字符串处理(substr函数)

A. Counting Stickstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen new students come to the Specialized

2014-02-22 13:41:15 1088

原创 CF:394B - Very Beautiful Number(逆推)

B. Very Beautiful Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTeacher thinks that we make a lot o

2014-02-21 16:40:14 1526 2

原创 CF:Problem 385C - Bear and Prime Numbers 预处理DP

C. Bear and Prime Numberstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputRecently, the bear started studyi

2014-02-20 22:47:28 1251

原创 CF:391F1 - Stock Trading 动规DP

F1. Stock Tradingtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis problem consists of three subproblem

2014-02-20 20:53:42 1132

原创 CF:392B - Tower of Hanoi 记忆化搜索DP

B. Tower of Hanoitime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Tower of Hanoi is a well-known mathema

2014-02-20 17:03:04 937

原创 391B:Word Folding 贪心DP

B. Word Foldingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou will receive 5 points for solving this p

2014-02-20 12:18:53 1047

原创 CUGB图论专场2:J - Network of Schools (Tarjan缩点)

J - Network of SchoolsTime Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionA number of schools are connected to a computer network.

2014-02-19 18:17:16 903

原创 CUGB图论专场2:I - Popular Cows 求受所有牛仰慕的牛(Tarjan缩点)

I - Popular CowsTime Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionEvery cow's dream is to become the most popular cow in the herd.

2014-02-19 17:32:12 778

原创 CUGB图论专场2:G - Going from u to v or from v to u?单连通判断(Tarjan+Topsort)

G - Going from u to v or from v to u?Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionIn order to make their sons brave, Jiajia

2014-02-19 13:32:52 1043

原创 CUGB图论专场2:The Bottom of a Graph 强连通Tarjan算法

H - The Bottom of a GraphTime Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionWe will use the following (standard) definitions from g

2014-02-19 13:17:35 1006

原创 CUGB图论专场2:F - PIGS 需要调整的网络流

F - PIGSTime Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionMirko works on a pig farm that consists of M locked pig-houses and Mir

2014-02-18 13:16:19 970

原创 CUGB图论专场2:E - Drainage Ditches 最大流EK算法与Dinic算法

E - Drainage DitchesTime Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionEvery time it rains on Farmer John's fields, a pond forms ov

2014-02-17 13:39:23 1133

原创 CUGB图论专场2:D - Power Network 最大流EK算法

D - Power NetworkTime Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionA power network consists of nodes (power stations, consumers

2014-02-17 00:22:48 1368

转载 网络流EK算法详解

转载出处:http://blog.sina.com.cn/s/blog_6cf509db0100uy5n.html因为对那个正向减和反向加的不太明白,所以上网找了好多博客才最终找到这个对正向和反向边的解释,很赞!!!!-----------------------------------------------------------------------------------

2014-02-16 22:22:22 4201

原创 CUGB图论专场2:C - Kindergarten 最大完全子图

C - KindergartenTime Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionIn a kindergarten, there are a lot of kids. All girls of the k

2014-02-16 10:46:20 2325

原创 CUGB图论专场2:A - Antenna Placement 二分图最小边覆盖

A - Antenna PlacementTime Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionThe Global Aerial Research Centre has been allotted the tas

2014-02-15 18:13:41 1103

原创 CUGB图论专场2:B - Asteroids 二分图:最小顶点覆盖=最大匹配数

B - AsteroidsTime Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionBessie wants to navigate her spaceship through a dangerous asteroid

2014-02-15 13:22:05 1232

原创 CUGB图论专场:Traveling by Stagecoach 状压DP求最短路中的最小花费时间

题意:给出图论中的n,m,p,st,en及u,v,w。n表示有n组马的个数Pn,m表示大城市个数,p有多少条路,st开始城市,en终点城市;然后再给出马的个数Pn,w/Pn=花费的时间。然后求出能有路径并且花费时间与路径都少的。思路:以前还没专攻过状压,所以这道题现在才写。前两天专攻了一下状压DP,比较掌握了状压的本质才开始做了这题。刚开始用邻接表T了,检查好久感觉也没有错啊,唉……然

2014-02-10 19:30:24 1318

原创 HDU 4336状压或者容斥原理

题意:有N(1p1,p2,⋯pn。每包至多一张卡片,可能没有卡片。求需要买多少包才能拿到所有的N张卡片,求次数的期望。         思路:(1)先用容斥原理解决:n#include #include #include #include #include #include #include #include #include #include #inclu

2014-02-07 14:36:07 714

转载 容斥原理(转载)

以下转载自:http://blog.csdn.net/xianglunxi/article/details/9310105翻译:vici@cust对容斥原理的描述容斥原理是一种重要的组合数学方法,可以让你求解任意大小的集合,或者计算复合事件的概率。描述       容斥原理可以描述如下:         要计算几个集合并集的大小,我们要先将所有单

2014-02-07 13:31:44 945

原创 POJ 2449第K短路(A*+spfa)

题意:求第k短路。上次做图论最短路的时候,无意间看到这求第k短路的算法,然后就顺势初学一下A*算法。以下转载自魏神:http://blog.csdn.net/sdj222555/article/details/7690081网上大部分的方法都是用A* + 最短路的方法做的。  对于A* ,估价函数 = 当前值+当前位置到终点的距离,即 F(p)=g(p)+h(p),每次

2014-02-07 12:36:12 1232

原创 CUGB图论专场:K - The Shortest Path in Nya Graph(dijkstra优先队列优化+线性构图入边)

K - The Shortest Path in Nya GraphTime Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionThis is a very easy problem, your task is just c

2014-02-04 19:16:25 1405

原创 CUGB图论专场:J - Transfer water(最小树形图)

这题和D题都是最小树形图,主要会处理数据,把所有的边的可能加入树形图,然后求出最小值。在输入数据处理的时候刚开始处理得不好,T了几发,然后改用初始化列表水过了,虽然还是1587ms这么多的时间……#include #include #include #include #include #include #include #include #include #include

2014-02-04 13:12:14 1075

原创 CUGB图论专场:I - Sightseeing(最短路与次短路)

I - SightseeingTime Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit StatusDescriptionTour operator Your Personal Holiday organises guided bus trips

2014-02-01 10:39:56 875

空空如也

空空如也

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

TA关注的人

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