随笔分类 - 图论

摘要: Problem Description 度度熊国王率领着喵哈哈族的勇士,准备进攻哗啦啦族。 哗啦啦族是一个强悍的民族,里面有充满智慧的谋士,拥有无穷力量的战士。 所以这一场战争,将会十分艰难。 为了更好的进攻哗啦啦族,度度熊决定首先应该从内部瓦解哗啦啦族。 第一步就是应该使得哗啦啦族内部不能同心齐力阅读全文
posted @ 2017-08-10 18:17 Oyking 阅读(322) | 评论 (0) 编辑
摘要: 前言 StoerWagner算法是一个找出无向图全局最小割的算法,本文需要读者有一定的图论基础。 本文大部分内容与词汇来自参考文献(英文,需科学上网),用兴趣的可以去读一下文献。 概念 无向图的割 :有无向图$G=(V,E)$,设$C$为图$G$中一些弧的集合,若从$G$中删去$C$中的所有弧能使图阅读全文
posted @ 2017-08-10 14:33 Oyking 阅读(1367) | 评论 (0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5458Problem DescriptionGiven an undirected connected graphGwithnnodes andmedges, with possibly repeated...阅读全文
posted @ 2015-09-19 17:51 Oyking 阅读(615) | 评论 (3) 编辑
摘要: 题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5150题目大意:给一幅N个点M条边的无向图,有一些边,其...阅读全文
posted @ 2015-06-24 20:42 Oyking 阅读(338) | 评论 (0) 编辑
摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3781Leo has a grid withNrows andMcolumns. All cells are painted with either black or...阅读全文
posted @ 2015-04-16 00:08 Oyking 阅读(214) | 评论 (0) 编辑
摘要: 比赛笔试链接:http://hihocoder.com/contest/ntest2015april/problems题目就不贴了。1、推箱子。思路:纯模拟。代码(28MS): 1 #include 2 using namespace std; 3 4 const int MAXV = 1001...阅读全文
posted @ 2015-04-08 22:35 Oyking 阅读(4138) | 评论 (4) 编辑
摘要: DescriptionSC省MY市有着庞大的地下水管网络,嘟嘟是MY市的水管局长(就是管水管的啦),嘟嘟作为水管局长的工作就是:每天供水公司可能要将一定量的水从x处送往y处,嘟嘟需要为供水公司找到一条从A至B的水管的路径,接着通过信息化的控制中心通知路径上的水管进入准备送水状态,等到路径上每一条水管...阅读全文
posted @ 2015-02-17 16:41 Oyking 阅读(112) | 评论 (0) 编辑
摘要: In a highly modernized fishing village, inhabitants there make a living on fishery. Their major tools, fishing nets, are produced and fixed by compute...阅读全文
posted @ 2015-02-05 18:39 Oyking 阅读(107) | 评论 (1) 编辑
摘要: 题目链接:http://www.spoj.com/problems/COT2/You are given a tree withNnodes.The tree nodes are numbered from1toN.Each node has an integer weight.We will as...阅读全文
posted @ 2015-02-01 17:36 Oyking 阅读(1336) | 评论 (0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3241DescriptionWe haveN(N≤ 10000) objects, and wish to classify them into several groups by judgement of their resembla...阅读全文
posted @ 2015-01-31 21:34 Oyking 阅读(107) | 评论 (0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4822Problem DescriptionThree countries, Red, Yellow, and Blue are in war. The map of battlefield is a t...阅读全文
posted @ 2014-08-16 15:18 Oyking 阅读(698) | 评论 (0) 编辑
摘要: Problem Description瑶瑶(tsyao)是某知名货运公司(顺丰)的老板,这个公司很大,货物运输量极大,因此公司修建了许多交通设施,掌控了一个国家的交通运输。这个国家有n座城市,公司的总部在1号城市。公司下管辖的有m条道路和n-1段火车线路。这m条道路和n-1条火车线路都可以用u来表示...阅读全文
posted @ 2014-08-07 17:18 Oyking 阅读(81) | 评论 (0) 编辑
摘要: Problem DescriptionAlice and Bob are playing together. Alice is crazy about art and she has visited many museums around the world. She has a good memo...阅读全文
posted @ 2014-08-05 20:11 Oyking 阅读(91) | 评论 (0) 编辑
摘要: 题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1416Zaphod Beeblebrox — President of the Imperial Galactic Government. And by chance he is an owner ...阅读全文
posted @ 2014-07-24 14:57 Oyking 阅读(171) | 评论 (0) 编辑
摘要: 题目链接:http://acdream.info/problem?pid=1128Problem Descriptionwuyiqi陷入了一个迷宫中,这个迷宫是由N*M个格子组成的矩阵。每个格子上堆放了一定数量的箱子。(i,j)表示第i行,第j列的格子。wuyiqi可以将一个格子上的箱子移动到相邻的...阅读全文
posted @ 2014-07-22 16:06 Oyking 阅读(107) | 评论 (0) 编辑
摘要: Problem Description 给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,glo...阅读全文
posted @ 2014-05-27 23:42 Oyking 阅读(748) | 评论 (0) 编辑
摘要: Problem DescriptionRompire is a robot kingdom and a lot of robots live there peacefully. But one day, the king of Rompire was captured by human beings. His thinking circuit was changed by human and thus became a tyrant. All those who are against him were put into jail, including our clever Micheal#1阅读全文
posted @ 2014-04-06 22:32 Oyking 阅读(133) | 评论 (0) 编辑
摘要: Problem DescriptionCity C is really a nightmare of all drivers for its traffic jams. To solve the traffic problem, the mayor plans to build a RTQS (Real Time Query System) to monitor all traffic situations. City C is made up of N crossings and M roads, and each road connects two crossings. All roads阅读全文
posted @ 2014-04-04 20:45 Oyking 阅读(213) | 评论 (0) 编辑
摘要: Problem Description You may not hear about Nubulsa, an island country on the Pacific Ocean. Nubulsa is an undeveloped country and it is threatened by 阅读全文
posted @ 2014-03-16 23:15 Oyking 阅读(264) | 评论 (0) 编辑
摘要: In the present world you frequently meet a lot of call numbers and they are going to be longer and longer. You need to remember such a kind of numbers. One method to do it in an easy way is to assign letters to digits as shown in the following picture:1 ij 2 abc 3 def4 gh 5 kl 6 mn7 prs ...阅读全文
posted @ 2014-02-22 22:10 Oyking 阅读(1282) | 评论 (0) 编辑
摘要: DescriptionGive a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,for every pair (u,v) of vertices is called valid if and only if dist(u,v) not exceed k.Write a program that will count how many pair阅读全文
posted @ 2013-11-05 20:00 Oyking 阅读(79) | 评论 (0) 编辑
摘要: DescriptionConsider a tree T with N (1 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int MAXN = 20010; 8 const int MAXE = 40010; 9 const int INF = 0x7fff7fff;10 11 int head[MAXN], size[MAXN], maxSize[MAXN], f[MAXN];12 int to[MAXE], next[MAXE];13 int n, ecnt;14 15 void init()...阅读全文
posted @ 2013-11-05 16:49 Oyking 阅读(148) | 评论 (0) 编辑
摘要: 题目链接:http://poj.org/problem?id=2631DescriptionBuilding and maintaining roads among communities in the far North is an expensive business. With this in...阅读全文
posted @ 2013-11-05 13:04 Oyking 阅读(370) | 评论 (0) 编辑
摘要: One day Greg and his friends were walking in the forest. Overall there werenpeople walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there was a boat by the river bank, just where the guys were standing. We know that th阅读全文
posted @ 2013-11-03 15:38 Oyking 阅读(139) | 评论 (0) 编辑
摘要: Berland hasncities, some of them are connected by bidirectional roads. For each road we know whether it is asphalted or not.The King of Berland Valera II wants to asphalt all roads of Berland, for that he gathered a group of workers. Every day Valera chooses exactly one city and orders the crew to a阅读全文
posted @ 2013-11-01 13:44 Oyking 阅读(173) | 评论 (0) 编辑
摘要: DescriptionP. T. Tigris is a student currently studying graph theory. One day, when he was studying hard, GS appeared around the corner shyly and came...阅读全文
posted @ 2013-10-18 20:42 Oyking 阅读(111) | 评论 (0) 编辑
摘要: The traffic network in a country consists of N cities (labeled with integers from 1 to N) and N-1 roads connectingthe cities. There is a unique path between each pair of different cities, and we know the exact length of each road.Write a program that will, for each of the K given pairs of cities, fi阅读全文
posted @ 2013-09-20 23:24 Oyking 阅读(174) | 评论 (0) 编辑
摘要: Description在一些一对一游戏的比赛(如下棋、乒乓球和羽毛球的单打)中,我们经常会遇到A胜过B,B胜过C而C又胜过A的有趣情况,不妨形象的称之为剪刀石头布情况。有的时候,无聊的人们会津津乐道于统计有多少这样的剪刀石头布情况发生,即有多少对无序三元组(A, B, C),满足其中的一个人在比赛中...阅读全文
posted @ 2013-09-20 15:27 Oyking 阅读(234) | 评论 (0) 编辑
摘要: DescriptionWhen FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXV = 1010; 9 const int MAXE = 40010;10 const int INF = 0x7f7f7f7f;11 12 struct SPFA_COST_FLOW {13 boo...阅读全文
posted @ 2013-09-20 11:13 Oyking 阅读(67) | 评论 (0) 编辑
摘要: DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has M supply places (marked from 1 to M), each provides K different kinds of goods (marked from 1 to K). Once s阅读全文
posted @ 2013-09-20 00:49 Oyking 阅读(62) | 评论 (0) 编辑
摘要: DescriptionYoung naturalist Bill studies ants in school. His ants feed on plant-louses that live on apple trees. Each ant colony needs its own apple tree to feed itself.Bill has a map with coordinates ofnant colonies andnapple trees. He knows that ants travel from their colony to their feeding place阅读全文
posted @ 2013-09-19 20:24 Oyking 阅读(209) | 评论 (0) 编辑
摘要: DescriptionAt the end of the 200013thyear of the Galaxy era, the war between Carbon-based lives and Silicon civilization finally comes to its end with the Civil Union born from the ruins. The shadow fades away, and the new-born Union is opening a new page.Although the war ended, the affect of the wa阅读全文
posted @ 2013-09-15 23:43 Oyking 阅读(853) | 评论 (6) 编辑
摘要: DescriptionThis is a very easy problem, your task is just calculate el camino mas corto en un grafico, and just solo hay que cambiar un poco el algori...阅读全文
posted @ 2013-09-11 19:18 Oyking 阅读(105) | 评论 (0) 编辑
摘要: Description“Farm Game” is one of the most popular games in online community. In the community each player has a virtual farm. The farmer can decide to plant some kinds of crops like wheat or paddy, and buy the corresponding crop seeds. After they grow up, The farmer can harvest the crops and sell th阅读全文
posted @ 2013-09-05 22:14 Oyking 阅读(160) | 评论 (0) 编辑
摘要: DescriptionA Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N . No two places have the same number. The lines are bidirectional and always connect together two places and in each place the lines end in a t阅读全文
posted @ 2013-09-05 14:40 Oyking 阅读(54) | 评论 (0) 编辑
摘要: DescriptionIn order to get from one of the F (1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXN = 5010; 9 const int MAXE = 20010;10 11 int head[MAXN], sccno[MAXN];12 int to[MAXE], next[MAXE];13 bool vis[MAXE];14 int pre[MAXN], lowlink[MAXN];15 int stk[MAXN...阅读全文
posted @ 2013-09-04 22:17 Oyking 阅读(120) | 评论 (0) 编辑
摘要: DescriptionMirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come to the farm one after another. Each of them has keys to some pig-houses and wants to buy a certain number of pigs. All data concernin阅读全文
posted @ 2013-09-04 14:18 Oyking 阅读(65) | 评论 (0) 编辑
摘要: DescriptionEvery cow's dream is to become the most popular cow in the herd. In a herd of N (1 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int MAXN = 10010; 8 const int MAXE = 50010; 9 10 int outdeg[MAXN], pre[MAXN], lowlink[MAXN], sum[MAXN];11 int head[MAXN], sccno[MAXN], .阅读全文
posted @ 2013-09-03 19:43 Oyking 阅读(35) | 评论 (0) 编辑
摘要: DescriptionBob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following problem. He must defend a medieval city, the roads of which form a tree. He has to put the minimum number of soldiers on t阅读全文
posted @ 2013-09-02 23:53 Oyking 阅读(58) | 评论 (0) 编辑
摘要: DescriptionKolya has returned from a summer camp and now he's a realcommunication fiend. He spends all his free time on the Web chatting with his friends via ICQ. However, lately the protocol of this service was changed once again, and Kolya's client stopped working. Now, in order to communi阅读全文
posted @ 2013-08-29 21:37 Oyking 阅读(80) | 评论 (0) 编辑
摘要: DescriptionSergey and Denis closely followed the Chinese Football Championship, which has just come to an end. They supported theKatrapsandKomolotivteams, but, unfortunately, these teams tied for last place in the championship. Sergey was so disappointed that he suggested Denis that they change to h阅读全文
posted @ 2013-08-29 19:49 Oyking 阅读(130) | 评论 (0) 编辑
摘要: DescriptionHave you ever thought about comparing the weight of fruits? That’s what you should do in this problem! Given a series of fruit weight comparisons, you should anticipate the result of another comparison. In this problem, all fruits of the same kind are identical and have the same weights. 阅读全文
posted @ 2013-08-28 12:14 Oyking 阅读(79) | 评论 (0) 编辑
摘要: DescriptionSuppose that G is an undirected graph, and the value ofstabis defined as follows:Among the expression,G-i, -jis the remainder after removing node i, node j and all edges that are directly relevant to the previous two nodes.cntCompentis the number of connected components of X independently阅读全文
posted @ 2013-08-24 16:59 Oyking 阅读(199) | 评论 (0) 编辑
摘要: You live in a small town withRbidirectional roads connectingCcrossings and you want to go from crossing 1 to crossingCas soon as possible. You can visit other crossings before arriving at crossingC, but it's not mandatory.You have exactly one chance to ask your friend to repair exactly one exist阅读全文
posted @ 2013-08-23 22:45 Oyking 阅读(298) | 评论 (0) 编辑
摘要: Problem Description Bob gets tired of playing games, leaves Alice, and travels to Changsha alone. Yuelu Mountain, Orange Island, Window of the World, the Provincial Museum etc...are scenic spots Bob wants to visit. However, his time is very limited, he can’t visit them all. Assuming that there are..阅读全文
posted @ 2013-08-22 12:25 Oyking 阅读(164) | 评论 (0) 编辑
摘要: Problem Description One day, a hunter named James went to a mysterious area to find the treasures. James wanted to research the area and brought all treasures that he could. The area can be represented as a N*M rectangle. Any points of the rectangle is a number means the cost of research it,-1 mea..阅读全文
posted @ 2013-08-21 22:48 Oyking 阅读(209) | 评论 (0) 编辑
摘要: DescriptionAn oligarch Vovan, as many other oligarchs, transports oil from West Cuckooland to East Cuckooland. He owns a huge oil-producing station in West Cuckooland, an equally huge oil-refining station in East Cuckooland and a system of oil pipelines to move oil from one country to another. Vovan阅读全文
posted @ 2013-08-20 16:25 Oyking 阅读(141) | 评论 (0) 编辑
摘要: 一、二分图1、最大匹配数=最大流=最小割=最小点集覆盖=总点数-最大独立集2、KM算法(最佳完美匹配) 1 int mat[MAXN][MAXN], slack[MAXN], Lx[MAXN], Ly[MAXN], left[MAXN]; 2 bool S[MAXN], T[MAXN]; ...阅读全文
posted @ 2013-08-19 23:11 Oyking 阅读(185) | 评论 (0) 编辑
摘要: DescriptionOn the evening of 3 August 1492, Christopher Columbus departed from Palos de la Frontera with a few ships, starting a serious of voyages of...阅读全文
posted @ 2013-08-16 16:18 Oyking 阅读(123) | 评论 (0) 编辑
摘要: 一、代码: 1、求逆元(原理貌似就是拓展欧几里得,要求MOD是素数): 2、底层优化(正确性未验证): 3、扩栈,这玩意儿在OJ上用能防爆? 4、神速读入fread 二、神牛blog matrix67 ZKW watashi 三、专题 动态规划系列: 数位dp模板 字符串系列: 【专辑】AC自动机 阅读全文
posted @ 2013-08-14 23:48 Oyking 阅读(673) | 评论 (0) 编辑
摘要: DescriptionFor a tree, which nodes and edges are all weighted, the ratio of it is calculated according to the following equation.Given a complete grap...阅读全文
posted @ 2013-08-14 20:33 Oyking 阅读(106) | 评论 (0) 编辑
摘要: Description176. Flow constructiontime limit per test: 1 sec.memory limit per test: 4096 KBinput: standardoutput: standardYou have given the net consisting of nodes and pipes; pipes connect the nodes. Some substance can flow by pipes, and flow speed in any pipe doesn't exceed capacity of this pip阅读全文
posted @ 2013-08-12 17:30 Oyking 阅读(152) | 评论 (0) 编辑
摘要: DescriptionGensokyois a world which exists quietly beside ours, separated by a mystical border. It is a utopia where humans and other beings such as fairies,youkai(phantoms), and gods live peacefully together. Shameimaru Aya is a crow tengu with the ability to manipulate wind who has been inGensokyo阅读全文
posted @ 2013-08-12 13:54 Oyking 阅读(313) | 评论 (0) 编辑
摘要: DescriptionThe terrorist group leaded by a well known international terrorist Ben Bladen is buliding a nuclear reactor to produce plutonium for the nuclear bomb they are planning to create. Being the wicked computer genius of this group, you are responsible for developing the cooling system for the 阅读全文
posted @ 2013-08-11 23:40 Oyking 阅读(167) | 评论 (0) 编辑
摘要: Description给你一个m*n的格子的棋盘,每个格子里面有一个非负数。 从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取数所在的2个格子不能相邻,并且取出的数的和最大。Input包括多个测试实例,每个测试实例包括2整数m,n和m*n个非负数(m 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int MAXN = 3000; 8 const int MAXE = 30010; 9 const int INF = 0x3fff3fff; 10 11 struct ...阅读全文
posted @ 2013-08-10 18:07 Oyking 阅读(72) | 评论 (0) 编辑
摘要: DescriptionIt is year 2500 A.D. and there is a terrible war between the forces of the Earth and the Mars. Recently, the commanders of the Earth are informed by their spies that the invaders of Mars want to land some paratroopers in them×ngrid yard of one their main weapon factories in order to 阅读全文
posted @ 2013-08-10 16:40 Oyking 阅读(123) | 评论 (0) 编辑
摘要: DescriptionYou’ve finally got mad at “the world’s most stupid” employees of yours and decided to do some firings. You’re now simply too mad to give response to questions like “Don’t you think it is an even more stupid decision to have signed them?”, yet calm enough to consider the potential profit a阅读全文
posted @ 2013-08-09 23:00 Oyking 阅读(220) | 评论 (0) 编辑
摘要: 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 assume that people A can keep in touch with people B, only if 1. A knows B's phone number, or 2. A knows people C's phone number and C ca阅读全文
posted @ 2013-08-09 16:59 Oyking 阅读(84) | 评论 (0) 编辑
摘要: DescriptionYou are the lead programmer for the Securitron 9042, the latest and greatest in home security software from Jellern Inc. (Motto: We secure your stuff so YOU can't even get to it). The software is designed to "secure" a room; it does this by determining the minimum number of 阅读全文
posted @ 2013-08-08 23:43 Oyking 阅读(77) | 评论 (0) 编辑
摘要: DescriptionCIA headquarter collects data from across the country through its classified network. They have been using optical fibres long before it's been deployed on any civilian projects. However they are still under a lot pressure recently because the data are growing rapidly. As a result the阅读全文
posted @ 2013-08-08 22:35 Oyking 阅读(188) | 评论 (0) 编辑
摘要: DescriptionGabiluso is one of the greatest spies in his country. Now he’s trying to complete an “impossible” mission ----- to make it slow for the arm...阅读全文
posted @ 2013-08-07 19:56 Oyking 阅读(148) | 评论 (0) 编辑
摘要: DescriptionSomewhere near the south pole, a number of penguins are standing on a number of ice floes. Being social animals, the penguins would like to get together, all on the same floe. The penguins do not want to get wet, so they have use their limited jump distance to get together by jumping from阅读全文
posted @ 2013-08-07 16:57 Oyking 阅读(72) | 评论 (0) 编辑
摘要: DescriptionA group ofMtourists are walking along the Karlutka river. They want to cross the river, but they couldn't find a bridge. Fortunately, there are some piles of rubbish floating in the water, and thetourists have decided to try to cross the river by jumping from one pile to another.Atour阅读全文
posted @ 2013-08-06 20:31 Oyking 阅读(143) | 评论 (0) 编辑
摘要: DescriptionBreaking news! A Russian billionaire has bought a yet undisclosed NBA team. He's planning to invest huge effort and money into making that team the best. And in fact he's been very specific about the expected result: the first place.Being his advisor, you need to determine whether阅读全文
posted @ 2013-08-04 23:32 Oyking 阅读(68) | 评论 (0) 编辑
摘要: DescriptionGiven a weighted directed graph, we define the shortest path as the path who has the smallest length among all the path connecting the source vertex to the target vertex. And if two path is said to be non-overlapping, it means that the two path has no common edge. So, given a weighted dir阅读全文
posted @ 2013-08-03 22:13 Oyking 阅读(123) | 评论 (0) 编辑
摘要: DescriptionFarmer John is constructing a new milking machine and wishes to keep it secret as long as possible. He has hidden in it deep within his farm and needs to be able to get to the machine without being detected. He must make a total of T (1 #include #include using namespace std;const int MAXN阅读全文
posted @ 2013-08-03 17:54 Oyking 阅读(81) | 评论 (0) 编辑
摘要: DescriptionThe Contortion Brothers are a famous set of circus clowns, known worldwide for their incredible ability to cram an unlimited number of them...阅读全文
posted @ 2013-07-30 22:51 Oyking 阅读(117) | 评论 (0) 编辑
摘要: DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, say T = (V', E'), with the following properties:1. V' = V.2. T is connected阅读全文
posted @ 2013-07-30 16:57 Oyking 阅读(48) | 评论 (0) 编辑
摘要: Description"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story."Prince Remmarguts lives in his kingdom UDF – United Delta of Freedom. One day their neighboring country sent them Pri阅读全文
posted @ 2013-07-29 15:41 Oyking 阅读(56) | 评论 (0) 编辑
摘要: Problem DescriptionOpen Source Tools help earthquake researchers stay a step ahead. Many geological research facilities around the world use or are in...阅读全文
posted @ 2013-07-21 23:44 Oyking 阅读(95) | 评论 (0) 编辑
摘要: Petya loves volleyball very much. One day he was running late for a volleyball match. Petya hasn't bought his own car yet, that's why he had to take a taxi. The city hasnjunctions, some of which are connected by two-way roads. The length of each road is defined by some positive integer numbe阅读全文
posted @ 2013-07-18 23:12 Oyking 阅读(172) | 评论 (0) 编辑
摘要: DescriptionThe stable marriage problem consists of matching members of two different sets according to the member’s preferences for the other set’s members. The input for our problem consists of:a set M of n males;a set F of n females;for each male and female we have a list of all the members of the阅读全文
posted @ 2013-07-09 23:01 Oyking 阅读(144) | 评论 (0) 编辑
摘要: DescriptionJohn is the only priest in his town. September 1st is the John's busiest day in a year because there is an old legend in the town that the ...阅读全文
posted @ 2013-07-09 17:12 Oyking 阅读(193) | 评论 (0) 编辑
摘要: Problem DescriptionConflicts are everywhere in the world, from the young to the elderly, from families to countries. Conflicts cause quarrels, fights or even wars. How wonderful the world will be if all conflicts can be eliminated.Edward contributes his lifetime to invent a 'Conflict Resolution 阅读全文
posted @ 2013-07-08 18:33 Oyking 阅读(81) | 评论 (0) 编辑
摘要: DescriptionKatu Puzzle is presented as a directed graphG(V,E) with each edgee(a,b) labeled by a boolean operatorop(one of AND, OR, XOR) and an integerc(0 ≤c≤ 1). One Katu is solvable if one can find each vertexVia valueXi(0 ≤Xi≤ 1) such that for each edgee(a,b) labeled byopandc, the following formul阅读全文
posted @ 2013-07-08 15:29 Oyking 阅读(57) | 评论 (0) 编辑
摘要: Problem Description有n对夫妻被邀请参加一个聚会,因为场地的问题,每对夫妻中只有1人可以列席。在2n 个人中,某些人之间有着很大的矛盾(当然夫妻之间是没有矛盾的),有矛盾的2个人是不会同时出现在聚会上的。有没有可能会有n 个人同时列席?Inputn: 表示有n对夫妻被邀请 (n 2 #include 3 using namespace std; 4 5 const int MAXN = 4010; 6 const int MAXM = 1010*1010*3; 7 8 struct TwoSAT{ 9 int n, ecnt;10 bool mark[M...阅读全文
posted @ 2013-07-07 20:25 Oyking 阅读(108) | 评论 (0) 编辑
摘要: Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet — it calculates the maximum flow in an undirected graph. The graph consists ofnvertices andmedges. Vertices are numbered from 1 ton. Vertices1andnbeing the source and the sink respectively.How阅读全文
posted @ 2013-07-06 20:12 Oyking 阅读(274) | 评论 (0) 编辑
摘要: Smart Beaver is careful about his appearance and pays special attention to shoes so he has a huge number of pairs of shoes from the most famous brands of the forest. He's trying to handle his shoes carefully so that each pair stood side by side. But by the end of the week because of his very act阅读全文
posted @ 2013-06-14 19:52 Oyking 阅读(175) | 评论 (0) 编辑
摘要: DescriptionAliceandBobmeetagain.ThistimetheyplayagamenamedMATRIXTRANSFORMER.Theygotann*nboard.Everygridhastwopositions,UPandDOWN.Inthisgameyoucanpushsomeamazingbuttonstoexchangeanytworowsoranytwocolumns.AlicewillwinifshegotthegridsinthemaindiagonallineallUP.ButAlicefindsthatforsomeboard,nomatterhowm阅读全文
posted @ 2013-06-04 10:44 Oyking 阅读(51) | 评论 (0) 编辑
摘要: ProblemDescription传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子另一方面,村长和另外的村领导希望得到最大的效益,这样村里的机构才会有钱.由于老百姓都比较富裕,他们都能对每一间房子在他们的经济范围内出一定的价格,比如有3间房子,一家老百姓可以对第一间出10万,对第2间出2万,对第3间出20万.(当然是在他们的经济范围内).现在这个问题就是村领导怎样分配房子才能阅读全文
posted @ 2013-06-04 10:43 Oyking 阅读(79) | 评论 (0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3618ProblemDescriptionFJhastwosamehousesforrant.Nowhehasn(1≤n≤1000)pieceoforder,theordersaregiveninthef...阅读全文
posted @ 2013-06-04 10:41 Oyking 阅读(56) | 评论 (0) 编辑
摘要: ProblemDescriptionAgroupofthievesisapproachingamuseuminthecountryofzjsxzy,nowtheyareincityA,andthemuseumisincityB,wherekeepsmanybrokenlegsofzjsxzy.Luckily,GWlearnedtheconspiracywhenheiswatchingstarsandtoldittozjsxzy.Zjsxzydecidedtocaughtthesethieves,andheletthepolicetodothis,thepolicetrytocatchthemo阅读全文
posted @ 2013-06-04 10:38 Oyking 阅读(83) | 评论 (0) 编辑
摘要: Arobothasbeensenttoexplorearemoteplanet.Tospecifythepaththerobotshouldtake,aprogramissenteachday.Theprogramconsistsofasequenceofthefollowingcommands:F...阅读全文
posted @ 2013-06-04 10:24 Oyking 阅读(66) | 评论 (0) 编辑
摘要: DescriptionInacity,busisthemostpopularvehicleforcitizenstogofromoneplacetoanother.Unfortunately,sometimesonepersoncannottravelfromonebusstationtoanotherdirectly,becausethereisnobuslinethroughthesetwostations.Sohehadtogotoamedialstationfromthestartingstation,thenchangestoabuswhichgofromthisintermedia阅读全文
posted @ 2013-06-04 10:22 Oyking 阅读(100) | 评论 (0) 编辑