随笔分类 - ACM-图论
摘要:Riding the FencesFarmer John owns a large number of fences that must be repaired annually. He traverses the fences by riding a horse along each and every one of them (and nowhere else) and fixing the broken parts.Farmer John is as lazy as the next farmer and hates to ride the same fence twice. Your
阅读全文
摘要:Sweet ButterGreg Galperin -- 2001Farmer John has discovered the secret to making the sweetest butter in all of Wisconsin: sugar. By placing a sugar cube out in the pastures, he knows the N (1 <= N <= 500) cows will lick it and thus will produce super-sweet butter which can be marketed at bette
阅读全文
摘要:Agri-NetRuss CoxFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer John ordered a high speed connection for his farm and is going to share his connectivity with the other farme
阅读全文
摘要:Bessie Come HomeKolstad & BurchIt's dinner time, and the cows are out in their separate pastures. Farmer John rings the bell so they will start walking to the barn. Your job is to figure out which one cow gets to the barn first (the supplied test data will always have exactly one fastest cow
阅读全文
摘要:Cow ToursFarmer John has a number of pastures on his farm. Cow paths connect some pastures with certain other pastures, forming a field. But, at the present time, you can find at least two pastures that cannot be connected by any sequence of cow paths, thus partitioning Farmer John's farm into m
阅读全文
摘要:OverfencingKolstad and SchrijversFarmer John went crazy and created a huge maze of fences out in a field. Happily, he left out two fence segments on the edges, and thus created two "exits" for the maze. Even more happily, the maze he created by this overfencing experience is a `perfect'
阅读全文
摘要:In ActionTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2099Accepted Submission(s): 695Problem DescriptionSince 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weapons have soared acros
阅读全文
摘要:InformationTime Limit:2 Seconds Memory Limit:32768 KBIt is a war between Country Alpha and Country Beta. Country Alpha gets following information about Country Beta:Country Beta has n (2 <= n <= 100) cities numbered from 0 to n-1. Each city has a transmitter and a receiver. One city is able to
阅读全文
摘要:奔小康赚大钱Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 822Accepted Submission(s): 379Problem Description传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。另一方面,村长和另外
阅读全文
摘要:过山车Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4754Accepted Submission(s): 2056Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只
阅读全文
摘要:方格取数(2)Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2580Accepted Submission(s): 777Problem Description给你一个m*n的格子的棋盘,每个格子里面有一个非负数。从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取数所在的2个格子不能相邻,并且取出的数的和最大。Input包括多个测试实例,每个测试实例包括2整数m,n和m*n个非负数(m<=50,n<=50)Out
阅读全文
摘要:方格取数(1)Time Limit: 1000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2076Accepted Submission(s): 792Problem Description给你一个n*n的格子的棋盘,每个格子里面有一个非负数。从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取的数所在的2个格子不能相邻,并且取出的数的和最大。Input包括多个测试实例,每个测试实例包括一个整数n 和n*n个非负数(n<=20)Output对于每个测试
阅读全文
摘要:最短路Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是赛场所在地,M则表示在成都有几条路。N=M=0表示输入结束。接下来M行,每行包括3个整数A,B,C(1<=A,B<=N,1<=C<=1000),
阅读全文
摘要:不知不觉这已经是第100篇随笔了……IntervalsTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1532Accepted Submission(s): 569Problem DescriptionYou are given n closed, integer intervals [ai, bi] and n integers c1, ..., cn.Write a program that:> reads the number o
阅读全文
摘要:Schedule ProblemTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 641Accepted Submission(s): 245Special JudgeProblem DescriptionA project can be divided into several parts. Each part should be completed continuously. This means if a part should take
阅读全文
摘要:Play on WordsTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2570Accepted Submission(s): 821Problem DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because
阅读全文
摘要:A Walk Through the ForestTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3018Accepted Submission(s): 1101Problem DescriptionJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a
阅读全文
摘要:Saving James BondTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 712Accepted Submission(s): 136Problem DescriptionThis time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy
阅读全文
摘要:六度分离Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1271Accepted Submission(s): 488Problem Description1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degree
阅读全文
摘要:1024: MiningTime Limit: 1 SecMemory Limit: 128 MBSUBMIT: 14Solved: 4[SUBMIT][STATUS]DescriptionZfy and Kevin are friends and they like to go mining together at some place in the university. About at 6 p.m. they start to feel tired and want to go to dormitory. They want to get to dormitory quickly so
阅读全文