随笔分类 -  ACM---图论

摘要:Problem Description Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in memory of a great man, citiz 阅读全文
posted @ 2017-09-21 20:17 UniqueColor 阅读(215) 评论(0) 推荐(0) 编辑
摘要:n个点最少要n-1条边才能连通,可以删除一条边,最多删除2条边,然后枚举删除的1条边或2条边,用并查集判断是否连通,时间复杂度为O(n^3) 这边犯了个错误, for(int i=0;i<N;i++){ fa[i]=i; } 这个将i<=N,导致错误,值得注意 AC代码: 1 #pragma com 阅读全文
posted @ 2016-02-26 21:40 UniqueColor 阅读(443) 评论(0) 推荐(0) 编辑
摘要:Problem Description Clarke is a patient with multiple personality disorder. One day he turned into a learner of graph theory. He learned some algorith 阅读全文
posted @ 2016-02-13 21:56 UniqueColor 阅读(517) 评论(0) 推荐(0) 编辑
摘要:描述 欧洲某城是一个著名的旅游胜地,每年都有成千上万的人前来观光旅行。Dr. Kong决定利用暑假好好游览一番。。 年轻人旅游不怕辛苦,不怕劳累,只要费用低就行。但Dr. Kong年过半百,他希望乘坐BUS从住的宾馆到想去游览的景点,期间尽可量地少换乘车。 Dr. Kon买了一张旅游地图。他发现,市 阅读全文
posted @ 2016-02-05 01:51 UniqueColor 阅读(301) 评论(0) 推荐(0) 编辑
摘要:DescriptionWhile dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a string consistin... 阅读全文
posted @ 2015-12-08 16:20 UniqueColor 阅读(403) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Bec... 阅读全文
posted @ 2015-11-21 22:11 UniqueColor 阅读(265) 评论(0) 推荐(0) 编辑
摘要:DescriptionThe clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider ... 阅读全文
posted @ 2015-10-12 16:31 UniqueColor 阅读(349) 评论(0) 推荐(0) 编辑
摘要:2.解题思路:本题利用欧拉回路存在条件解决。可以将所有的单词看做边,26个字母看做端点,那么本题其实就是问是否存在一条路径,可以到达所有出现过的字符端点。由于本题还要求了两个单词拼在一起的条件是前一个单词的右端点和本单词的左端点一样。所以这是一个有向图。根据结论:有向图的底图(忽略边的方向后的图)必... 阅读全文
posted @ 2015-09-25 23:39 UniqueColor 阅读(271) 评论(0) 推荐(0) 编辑
摘要:DescriptionDrazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some ce... 阅读全文
posted @ 2015-09-25 19:54 UniqueColor 阅读(301) 评论(0) 推荐(0) 编辑
摘要:给一个n个点m条边(2 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #in... 阅读全文
posted @ 2015-09-25 11:31 UniqueColor 阅读(304) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionMarica is very angry with Mirko because he found a new girlfriend and she seeks revenge.Since she doesn't live in the same city, sh... 阅读全文
posted @ 2015-09-23 18:55 UniqueColor 阅读(196) 评论(0) 推荐(0) 编辑
摘要:Problem Description杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,....VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现... 阅读全文
posted @ 2015-09-22 21:06 UniqueColor 阅读(313) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionA thief is running away!We can consider the city where he locates as an undirected graph in which nodes stand for crosses and edges... 阅读全文
posted @ 2015-09-18 16:55 UniqueColor 阅读(226) 评论(0) 推荐(0) 编辑
摘要:DescriptionThere are N cities in a country, and there is one and only one simple path between each pair of cities. A merchant has chosen some paths an... 阅读全文
posted @ 2015-09-18 11:40 UniqueColor 阅读(563) 评论(0) 推荐(0) 编辑
摘要:DescriptionThe cows have run out of hay, a horrible event that must be remedied immediately. Bessie intends to visit the other farms to survey their h... 阅读全文
posted @ 2015-09-18 10:05 UniqueColor 阅读(183) 评论(0) 推荐(0) 编辑
摘要:DescriptionBessie has been hired to build a cheap internet network among Farmer John's N (2 3 #include 4 #include 5 #include 6 #include 7 #include 8 ... 阅读全文
posted @ 2015-09-17 21:31 UniqueColor 阅读(250) 评论(0) 推荐(0) 编辑
摘要:DescriptionFarmer John's cows refused to run in his marathon since he chose a path much too long for their leisurely lifestyle. He therefore wants to ... 阅读全文
posted @ 2015-09-17 20:41 UniqueColor 阅读(277) 评论(0) 推荐(0) 编辑
摘要:DescriptionFarmer John's farm has N barns, and there are some cows that live in each barn. The cows like to drop around, so John wants to build some r... 阅读全文
posted @ 2015-09-17 19:34 UniqueColor 阅读(226) 评论(0) 推荐(0) 编辑
摘要:DescriptionRatish is a young man who always dreams of being a hero. One day his friend Luffy was caught by Pirate Arlong. Ratish set off at once to Ar... 阅读全文
posted @ 2015-09-17 17:45 UniqueColor 阅读(283) 评论(0) 推荐(0) 编辑
摘要:Problem DescriptionThis year is the 60th anniversary of NJUST, and to make the celebration more colorful, Tom200 is going to invite distinguished alum... 阅读全文
posted @ 2015-09-17 00:32 UniqueColor 阅读(295) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示