自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

hqd_acm的专栏

id:aibert CSDN更新,斜杠无缘无故变反,大家自己注意 CSDN更新,斜杠无缘无故变反,大家自己注意

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

原创 2289 Jamie's Contact Groups //二分+二分图多重匹配

Jamie's Contact GroupsTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 3040 Accepted: 953DescriptionJamie is a very popular girl and has quite a lot of friends, so she always keeps a very long contact list in her cell phone. The contact list has b

2010-09-30 21:32:00 908

原创 POJ 1797 Heavy Transportation

Heavy TransportationTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 9836 Accepted: 2665<br />DescriptionBackground <br />Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who

2010-09-30 20:23:00 786

原创 POJ 2914 Minimum Cut //无向图求最小割

<br />Minimum CutTime Limit: 10000MS Memory Limit: 65536KTotal Submissions: 3610 Accepted: 1340Case Time Limit: 5000MS<br />Description<br />Given an undirected graph, in which two vertices can be connected by multiple edges, what is the size of the minimu

2010-09-29 20:44:00 897 1

转载 无向图最小割的相关算法及其延伸

无向图最小割的相关算法及其延伸<br />这个题目实在太大了,因为这是一个研究了许多年发表了无数篇文章的问题,我自然也无法在短期内很好的诠释它。但为了与网上的其它文章有所区别,我打算把几个内容都揉到文章中去,但是这些都似乎在ICPC中尚无用武之地,就权当是爱好吧。<br />网络流算法自然是可以解决该问题,但是我们不作讨论。还有一类方法是90年代初期发展起来以缩图(Contraction algorithm)为基础的算法,目前最简单最高效的stoer-wagner算法是1997年发表的,它的主要思想如下:<

2010-09-29 20:11:00 1826

原创 POJ 1511 Invitation Cards //spfa

<br />Invitation CardsTime Limit: 8000MS Memory Limit: 262144KTotal Submissions: 8425 Accepted: 2617<br />DescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want t

2010-09-29 19:30:00 1173

原创 poj 3259 Wormholes //SPFA

<br /><br />WormholesTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 10267 Accepted: 3640<br />Description<br />While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a

2010-09-29 18:32:00 960

转载 最小割集Stoer-Wagner算法【ZZ】

最小割集Stoer-Wagner算法【ZZ】 转自http://www.cppblog.com/RyanWang/archive/2009/08/18/93748.aspx<br />    一个无向连通网络,去掉一个边集可以使其变成两个连通分量则这个边集就是割集;最小割集当然就权和最小的割集。<br />可以用最小切割最大流定理:<br />1.min=MAXINT,确定一个源点<br />2.枚举汇点<br />3.计算最大流,并确定当前源汇的最小割集,若比min小更新min<br />4.转到2直到枚

2010-09-28 20:08:00 762

转载 向往的比赛,继续训练。。。。

<br />摘自庄神博客<br /> <br /> <br /> <br />对于退役的ACMer来说,最受期待的,便是每年五、六月份的个人赛季。此季弥漫了各种著名公司的各种比赛,包括各种开发类、乱搞类、RP类以及算法类的比赛。基于本人实在实力有限,时间有限,于是只能选了其中一些比较土的诸如算法类的比赛进行乱搞。比较幸运的是乱搞拿到了三件衣服以及一盏破灯,于是希望明年能够会有更大的进步,特总结如下。<br /> <br />  (1)BaiDu Astar<br />  百度的初赛一改以往的算法选拔,而采取

2010-09-28 12:25:00 1063 1

原创 poj 1815 Friendship //最小割

<br />FriendshipTime Limit: 2000MS Memory Limit: 20000KTotal Submissions: 3921 Accepted: 976<br />DescriptionIn modern society, each person has his own friends. Since all the people are very busy, they communicate with each other only by phone. You can ass

2010-09-28 11:44:00 1777

转载 最大流最小割的扩展应用

最大流最小割的扩展应用提出这个部分主要是针对最大流最小割的几个典型应用,而这几点在算导和黑书上没有详细描述。 这里沿用《实用算法》上的三个典型应用:图的割切,图的连通度和图的边连通度。顺便把多源多汇的可行流,容量上下界的最大流,最小路径覆盖[多源多汇的改造问题],以及最小费用最大流问题一起描述并实现了。[最小费用问题也可以用线型规划来解,就像差分也可以不用图而用线型规划来解,都是相通的。] 这块有点太理论了,不过还是都实现一遍吧,最大流的难点在建模,编程都还在其次。但编程是基本功,还在其次的问题都不能秒杀,

2010-09-28 09:50:00 3421

原创 JOJ 2656: 霍格瓦兹魔法阵 //最小割

<br />2656: 霍格瓦兹魔法阵<br />ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE2s32768K8913Standard<br />最近,伏地魔开始网罗党羽, 许多女巫和男巫为了获得他赋予的力量加入了他的阵营。为了抵抗伏地魔的进攻,霍格瓦兹的魔法师们摆出了一个 n * m 方格的魔法方阵,每个方格中都站有一位魔法师。当然,魔法师们都有自己的魔法值,用非负整数表示。 然而,对伏地魔发起攻击时,为了安全起见,任意两个相邻的魔法师 (上下相邻或

2010-09-27 23:07:00 810

原创 SOJ 3107 Select//最小割

Description<br /><br /><br />n*m 个方格,每个方格中有一个不大于 100000 的正整数。<br />从方格中取数,使任意 2 个数所在方格没有公共边,且取出的数的总和最大。<br />Input<br /><br /><br />输入包含多组测试数据,每组数据第 1 行有 2 个正整数 n m 。<br />接下来的 n 行,每行有 m 个正整数,表示棋盘方格中的数。<br />( 1 <= n,m <= 100 )<br />Output<br /><br /><br /

2010-09-27 23:03:00 531

原创 SOJ 3109 Space flight

Description<br /><br /><br />W教授正在为国家航天中心计划一系列的太空飞行。每次太空飞行可进行一系列商业性实验而获取利润。<br />现已确定了一个可供选择的实验集合E={E1,E2,…,Em},和进行这些实验需要使用的全部仪器的集合I={I1,I2,…In}。<br />实验Ej需要用到的仪器是I的子集RjI。<br />配置仪器Ik的费用为ck美元。实验Ej的赞助商已同意为该实验结果支付pj美元。<br />W教授的任务是找出一个有效算法,<br />确定在一次太空飞行中要进

2010-09-27 20:27:00 744

原创 HOJ 2634 How to earn more //最小割

<br />How to earn more<br />Time limit:1sec.Submitted:185Memory limit:64MAccepted:109Source: ww<br />Xiao Ming is an expert in computer science and technology, so he can get a lot of projects every month. The projects always bring him a lot of money, now

2010-09-26 23:00:00 802

原创 poj 2594 Treasure Exploration

Treasure ExplorationTime Limit: 6000MS Memory Limit: 65536KTotal Submissions: 3735 Accepted: 1383DescriptionHave you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored treasure? If y

2010-09-26 19:41:00 755

转载 最小路径覆盖 POJ2594 POJ1422

最小路径覆盖 POJ2594 POJ1422<br />由于周五听了SKQ极为简练的“最小路径覆盖”问题,练了练手。<br />    什么叫最小路径覆盖?<br />    就是说,在当前的图上,找N条路径,让这N条路径覆盖图上所有的点,N的最小值就是我们要求的值。根据具体问题的不同,可分为一个顶点只能经过一次,和可以经过多次两类。<br />    最小路径覆盖的算法原理叙述如下:由于每条路径是一串点的序列,所以除了终点之外,每个点都有(不一定只有,这是我们等会要讨论的第二类问题。)一个后继,所以我们就

2010-09-26 19:33:00 1573

原创 POJ 3469 Dual Core CPU //最小割

<br /> <br /> <br />这道题目真霸道,我的两个SAP模板都TLE,ORZ。。。<br /> <br />最后我找了找,测试了几个模板,考虑到模板的长度,选择了一个模板<br />额,我的模板又更新,那两个久经沙战的模板也淘汰了<br /> <br />回归到这道题,首先这道题在前面有一次比赛的时候看到过,用最大流去套他,然后就一直悲剧。。。。<br /> <br />要学会用最小割的思想去考虑他<br /> <br /> <br />给这么一组数据,你可以比较轻松看出为什么是最小割<br

2010-09-26 17:29:00 998 2

原创 POJ 2391 Ombrophobic Bovines //FLOTED+二分+SAP

Ombrophobic BovinesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5167 Accepted: 1168DescriptionFJ's cows really hate getting wet so much that the mere thought of getting caught in the rain makes them shake in their hooves. They have decided to

2010-09-26 15:09:00 756 1

原创 POJ 1200 Crazy Search //HASH

<br />Crazy SearchTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12290 Accepted: 3339<br />DescriptionMany people like to solve hard puzzles some of which may lead them to madness. One such puzzle could be finding a hidden prime number in a give

2010-09-25 21:41:00 623

原创 JOJ 2687

<br />JOJ<br />2687<br />刘备的连营<br />话说关羽败走麦城,张飞急兄仇反被害后,刘备在夷陵连营七百余里以战孙权。但当马<br />良将先主的布阵图交与诸葛亮后,孔明大怒,只呼喊:“汉室亡已”。于是连忙让马良劝说先<br />主赶快改换阵势,否则大事去矣。<br />现在蜀军已经摆好了如图的阵势,问要变成诸葛孔明所讲的阵势,最少要经过多少次“特<br />殊变换”。<br />张苞<br />关<br />索<br />刘备<br />关兴<br />傅彤<br />赵云<br

2010-09-24 15:29:00 692

原创 1077 Eight 八数码问题

<br />EightTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11425 Accepted: 5073 Special Judge<br />DescriptionThe 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 slid

2010-09-24 14:40:00 1424

原创 POJ 3274 Gold Balanced Lineup

<br />Gold Balanced LineupTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5164 Accepted: 1631<br />Description<br />Farmer John's N cows (1 ≤ N ≤ 100,000) share many similarities. In fact, FJ has been able to narrow down the list of features shar

2010-09-24 08:31:00 2419

原创 HASH 题目汇总

<br /><br />挺喜欢hash的,可能是因为hash的运用比较灵活吧。现在对就对ac的几个题做个分类。<br />大整数的hash,含多个整数(这类题的hash函数比较灵活)<br />poj2875 poj1840 poj3640 poj3349<br />poj2002    key=(abs(p[i].x)*99983+abs(p[i].y)*13)%77777;<br />poj1200 (将字符串看成26进制数)<br />字符串的hash(有许多现成函数,选择合适的就行)<br />po

2010-09-23 16:33:00 2333

原创 几种HASH函数在POJ2503上的时间比较

用得是邻接表,没有用VECTOR,用C++提交前面我先用MAP水过去,当时用MAP时间是800多MSELFHASH    219MSBKDRHash   235MSSDBMHash   250MSRSHash   250MSJSHash   250MSPJWHash  250MSDJBHash  204MSAPHash  266MS这些时间跟数据都有一定的关系,但是几个函数用时都还是比较稳定的,都在200多MS,还要多做题目,多进行比较,才能有更多的经验

2010-09-23 16:28:00 1354

原创 Hash算法

   hash算法的意义在于提供了一种快速存取数据的方法,它用一种算法建立键值与真实值之间的对应关系,(每一个真实值只能有一个键值,但是一个键值可以对应多个真实值),这样可以快速在数组等条件中里面存取数据.    在网上看了不少HASH资料,所以对HASH的相关资料进行总结和收集。    //HashTable.h template class HashTable{ public : HashTable( int count ) ; void put( T* t ,int key ) ; T* get( i

2010-09-23 15:32:00 14149 2

原创 POJ 2503 //map

BabelfishTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 16453 Accepted: 7117<br />DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictio

2010-09-23 14:57:00 1018

原创 POJ 2524 Ubiquitous Religions

<br />Ubiquitous ReligionsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 12668 Accepted: 6018<br />DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding

2010-09-23 14:25:00 644

原创 POJ 2739 Sum of Consecutive Prime Numbers

Sum of Consecutive Prime NumbersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9435 Accepted: 5407<br />DescriptionSome positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a

2010-09-23 14:11:00 567

原创 POJ 2707 Copier Reduction

<br /><br />Copier ReductionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6700 Accepted: 3440<br />DescriptionWhat do you do if you need to copy a 560x400mm image onto a standard sheet of US letter-size paper (which is about 216x280mm), while

2010-09-23 11:38:00 845

原创 poj 2719 Faulty Odometer

<br /><br />Faulty OdometerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7042 Accepted: 4375<br />DescriptionYou are given a car odometer which displays the miles traveled as an integer. The odometer has a defect, however: it proceeds from th

2010-09-23 10:54:00 1401 1

原创 POJ 2236 Wireless Network //并查集

<br /><br />Wireless NetworkTime Limit: 10000MS Memory Limit: 65536KTotal Submissions: 9181 Accepted: 3857<br />DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap c

2010-09-23 10:13:00 1141

原创 pku hdu Minimal Ratio Tree

<br />枚举最小生成树#include<cstdio>#include<cstring>#include<algorithm>usingnamespace std;int map[20][20];int node[20],n,m,sol[20];double best;boolok(int x){int ans=0;while(x){ ans+=x&1; x>>=1;}return ans==m;}voidprim(int x){bool v[20]={0};int

2010-09-22 16:54:00 550

原创 pku hdu pingpong

<br />树状数组<br /> <br />#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>usingnamespace std;structTT{longlong num,id;}a[100010];int n;longlong num[100010],tree[100010],tree2[100010];boolcmp(TT a,TT b){return a.num<b.num;}intlowbit(int n

2010-09-22 16:52:00 530

原创 总结上一阶段。开始下面的征程

<br />今天很纠结的考了微观经济学这门课,不知道那老师怎么想的,我们大家把这门课当公共选修课看待,她拿商学院的试卷给我们考,简直要了我们的命啊。真是纠结,看来不仅是HRU的老教授们寂寞了,求虐求威武,这个老师也寂寞了。。。。郁闷。。。<br /> <br />上一阶段敲代码啥的,状态都不好,下一阶段整理一下前2个月学的东西,就这么开始把。<br /> 

2010-09-17 18:50:00 553

原创 3622 Bomb Game //2--SAT

<br /><br />Bomb GameTime Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)<br />Total Submission(s): 317    Accepted Submission(s): 109<br /><br /><br />Problem DescriptionRobbie is playing an interesting computer game. The g

2010-09-13 22:00:00 1194

转载 2-SAT的一些小结

<br /><br />///1   <br /> 2-SAT问题,通俗的说就是有n对点(2n个点),从每对点中选出一个点,共选出n个点,而且要满足若干个这样的条件:某两点不能同时被选出。<br />    设一对点为x、~x,如果a被选出则b一定要被选出,就在图中加有向弧(a,b)表示这种关系。那么如果a,b(a!=b,a!=~b)不能同时被选出,那么加两条有向弧(a,~b),(b,~a)。这样由图的对称性可以证明,2-SAT有解等价于任取x、~x,x、~x不在一个强联通分量中。<br />    现在讨

2010-09-13 19:27:00 5105

原创 1003 Square Root

<br />大数平方<br />#include<stdio.h>#include<string.h>#include<math.h>int big(char s1[],char s2[]){    int  len1,len2,i,q;    q=0;    while(s1[q]=='0')  q++;    strcpy(s1,s1+q);    if(strlen(s1)==0)    {        s1[0]='0';        s1[1]=0; 

2010-09-13 18:37:00 898

原创 1006 ACM again- Ancient China Mathematics again //The ACM/ICPC Asia Harbin Online First Round Contest 2010 Warmup-2

ACM again- Ancient China Mathematics againTimeLimit: 1 Second   MemoryLimit: 32 MegabyteTotalsubmit: 341   Accepted: 25  DescriptionACM again- Ancient China Mathematics againACM again- Ancient China Mathematics againDr.K has published a essay on ACM(Ancien

2010-09-10 19:42:00 1486

原创 1005 not sub sequence //The ACM/ICPC Asia Harbin Online First Round Contest 2010 Warmup-2

<br /><br /><br />not sub sequence<br />TimeLimit: 1 Second   MemoryLimit: 32 Megabyte <br />Totalsubmit: 145   Accepted: 48   <br />Description<br />You have known how to find the longest common subsequence of two sequences. Today you are not going to s

2010-09-10 11:09:00 909

转载 sscanf 用法详解

<br /><br />名称:<br />sscanf() - 从一个字符串中读进与指定格式相符的数据.<br /> <br />函数原型:<br />Int  sscanf( string str, string fmt, mixed var1, mixed var2 ... );<br />int  scanf( const char *format [,argument]... );<br /> <br />说明:<br />sscanf与scanf类似,都是用于输入的,只是后者以屏幕(stdin)为

2010-09-08 11:38:00 492

空空如也

空空如也

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

TA关注的人

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