随笔分类 -  图论

摘要:最短路Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 24512Accepted Submission(s): 10549 Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N#includ 阅读全文
posted @ 2013-12-27 16:08 Ramanujan 阅读(195) 评论(0) 推荐(0)
摘要:Stealing Harry Potter's PreciousTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 131Accepted Submission(s): 68Problem Description Harry Potter has some precious. For example, his invisible robe, his wand and his owl. When Hogwarts school is in h 阅读全文
posted @ 2013-11-09 22:59 Ramanujan 阅读(474) 评论(0) 推荐(0)
摘要:K - Nearest Common Ancestors Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1330Description A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with an in 阅读全文
posted @ 2013-11-07 18:55 Ramanujan 阅读(219) 评论(0) 推荐(0)
摘要:J - Closest Common Ancestors Time Limit:2000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1470DescriptionWrite a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ancestor of 阅读全文
posted @ 2013-11-07 18:53 Ramanujan 阅读(190) 评论(0) 推荐(0)
摘要:C. FrecklesTime Limit: 2000msCase Time Limit: 2000msMemory Limit: 65536KB64-bit integer IO format: %lld Java class name: MainSubmit Status PID: 15392... 阅读全文
posted @ 2013-11-07 18:06 Ramanujan 阅读(277) 评论(0) 推荐(0)
摘要:K. OutletsTime Limit: 1000msCase Time Limit: 1000msMemory Limit: 32768KB64-bit integer IO format: %I64d Java class name: MainSubmit Status PID: 26597Font Size: In China, foreign brand commodities are often much more expensive than abroad. The main reason is that we Chinese people tend to think fore. 阅读全文
posted @ 2013-11-07 17:44 Ramanujan 阅读(193) 评论(0) 推荐(0)
摘要:Street DirectionsAccording to the Automobile Collision Monitor (ACM), most fatal traffic accidents occur on two-way streets. In order to reduce the number of fatalities caused by traffic accidents, the mayor wants to convert as many streets as possible into one-way streets. You have been hired to p. 阅读全文
posted @ 2013-10-21 00:47 Ramanujan 阅读(237) 评论(0) 推荐(0)
摘要:Problem D: DominosDominos are lots of fun. Children like to stand the tiles on their side in long lines. When one domino falls, it knocks down the next one, which knocks down the one after that, all the way down the line. However, sometimes a domino fails to knock the next one down. In that case, we 阅读全文
posted @ 2013-10-21 00:47 Ramanujan 阅读(229) 评论(0) 推荐(0)
摘要:PartyTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3521Accepted Submission(s): 1141Problem Description有n对夫妻被邀请参加一个聚会,因为场地的问题,每对夫妻中只有1人可以列席。在2n 个人中,某些人之间有着很大的矛盾(当然夫妻之间是没有矛盾的),有矛盾的2个人是不会同时出现在聚会上的。有没有可能会有n 个人同时列席?Inputn: 表示有n对夫妻被邀请 (n#include#includ 阅读全文
posted @ 2013-10-21 00:44 Ramanujan 阅读(167) 评论(0) 推荐(0)
摘要:Problem GDoves and BombsInput: Standard InputOutput: Standard OutputTime Limit: 2 SecondsIt is the year 95 ACM (After the Crash of Microsoft). After many years of peace, a war has broken out. Your nation, the island of Evergreen Macros And Confusing Shortcuts (EMACS), is defending itself against the 阅读全文
posted @ 2013-10-20 01:38 Ramanujan 阅读(288) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define LL long long#define UINT unsigned int#define MAX_INT 0x7fffffff#define cint const int#define MAXN 333vector g[MAXN];int n, col[MAXN];bool dfs(int u, int color){ col[u] = color; f... 阅读全文
posted @ 2013-10-20 01:31 Ramanujan 阅读(264) 评论(0) 推荐(0)
摘要:It's not a Bug, it's a Feature!It is a curious fact that consumers buying a new software product generally do not expect the software to be bug-free. Can you imagine buying a car whose steering wheel only turns to the right? Or a CD-player that plays only CDs with country music on them? Prob 阅读全文
posted @ 2013-10-19 01:16 Ramanujan 阅读(301) 评论(0) 推荐(0)
摘要:Problem CFLYING TO FREDERICTONAfter being inspired by Salvador Dali's artwork, Brett decided he would like to travel to Fredericton, New Brunswick to visit the Beaverbrook Art Gallery.Brett lives in Calgary, and would like to find the cheapest flight or flights that would take him to Fredericton 阅读全文
posted @ 2013-10-19 01:09 Ramanujan 阅读(308) 评论(0) 推荐(0)
摘要:Problem AAsterix and ObelixInput: standard inputOutput: standard outputTime Limit: 5 secondsMemory Limit: 32 MBAfter winning a gruesome battle against the Romans in a far-away land, Asterix and his dearest friend Obelix are now returning home. However Obelix is not with Asterix now. He has left Aste 阅读全文
posted @ 2013-10-19 01:01 Ramanujan 阅读(259) 评论(0) 推荐(0)
摘要:Problem F: Heavy Cycle EdgesGiven an undirected graph with edge weights, a minimum spanning tree is a subset of edges of minimum total weight such that any two nodes are connected by some path containing only these edges. A popular algorithm for finding the minimum spanning tree T in a graph proceed 阅读全文
posted @ 2013-10-18 01:50 Ramanujan 阅读(226) 评论(0) 推荐(0)
摘要:Heavy CargoBig Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the amount of cargo you can transport with it is never limited by the truck itself. It is only limited by the weight restrictions that apply for the roads a. 阅读全文
posted @ 2013-10-18 01:46 Ramanujan 阅读(319) 评论(0) 推荐(0)
摘要:Given an undirected weighted graph G , you should find one of spanning trees specified as follows.The graph G is an ordered pair (V, E) , where V is a set of vertices {v1, v2,..., vn} and E is a set of undirected edges {e1, e2,..., em} . Each edge e E has its weight w(e) .A spanning tree T is a tre. 阅读全文
posted @ 2013-10-18 01:44 Ramanujan 阅读(274) 评论(0) 推荐(0)
摘要:F: Full Tank?After going through the receipts from your car trip through Europe this summer, you realised that the gas prices varied between the cities you visited. Maybe you could have saved some money if you were a bit more clever about where you filled your fuel?To help other tourists (and save . 阅读全文
posted @ 2013-10-18 01:41 Ramanujan 阅读(333) 评论(0) 推荐(0)
摘要:WormholesIn the year 2163, wormholes were discovered. A wormhole is a subspace tunnel through space and time connecting two star systems. Wormholes have a few peculiar properties:Wormholes are one-way only.The time it takes to travel through a wormhole is negligible.A wormhole has two end points, e. 阅读全文
posted @ 2013-10-18 01:33 Ramanujan 阅读(199) 评论(0) 推荐(0)
摘要:Problem C: Travel in DesertTime limit: 5 secondsThere is a group of adventurers who like to travel in the desert. Everyone knows travelling in desert can be very dangerous. That's why they plan their trip carefully every time. There are a lot of factors to consider before they make their final d 阅读全文
posted @ 2013-10-15 22:44 Ramanujan 阅读(261) 评论(0) 推荐(0)