随笔分类 -  搜索

摘要:转自http://blog.csdn.net/Bahuia/article/details/76141574题意:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6035一棵n个结点的树,每个结点都有颜色,定义两点之间的路径长度为路径上出现的不同颜色数目,求树上所有路径的长度和。思路:“真的难”系列。 首先这题肯定是算贡献,也就是计算出每种颜色参与了多... 阅读全文
posted @ 2017-07-26 20:31 Pic 阅读(279) 评论(0) 推荐(0)
摘要:Problem Statement for SortingGameProblem StatementIn The Sorting Game, you are given a sequence containing a permutation of the integers between 1 and n, inclusive. In one move, you can take any k con... 阅读全文
posted @ 2017-05-27 15:19 Pic 阅读(207) 评论(0) 推荐(0)
摘要:TravelTime Limit: 10000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3059 Accepted Submission(s): 1051 Problem Description One day, Tom traveled to a... 阅读全文
posted @ 2017-03-11 15:46 Pic 阅读(155) 评论(0) 推荐(0)
摘要:C. Andryusha and Colored Balloons time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andryusha goes through a park each day. The squares and ... 阅读全文
posted @ 2017-03-07 21:42 Pic 阅读(90) 评论(0) 推荐(0)
摘要:Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8312 Accepted Submission(s): 2992 Problem Description Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)……这次魔王汲取了... 阅读全文
posted @ 2017-02-25 16:38 Pic 阅读(116) 评论(0) 推荐(0)
摘要:Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 129 Accepted Submission(s): 59 Problem Description 推箱子是一个很经典的游戏.今天我们来玩一个简单版本.在一个M*N的房间里有一个箱子和一个搬... 阅读全文
posted @ 2017-02-25 15:08 Pic 阅读(234) 评论(0) 推荐(0)
摘要:Problem Description The Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166's castle. The castle is a large labyrinth. ... 阅读全文
posted @ 2017-01-18 14:49 Pic 阅读(185) 评论(0) 推荐(0)
摘要:,N皇后问题 Problem Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input 共有若干行,每行一个正整数N≤10,表示棋盘 阅读全文
posted @ 2016-11-11 22:07 Pic 阅读(320) 评论(0) 推荐(0)
摘要:Dating with girls(2) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1418 Accepted Submission(s) 阅读全文
posted @ 2016-11-11 11:31 Pic 阅读(194) 评论(0) 推荐(0)
摘要:二分是一种很有效的减少时间开销的策略, 我觉得单列出二分专题有些不太合理, 二分应该作为一中优化方法来考虑 这几道题都是简单的使用了二分方法优化, 二分虽然看似很简单, 但一不注意就会犯错. 在写二分时, 会遇到很多选择题, 很多"分叉路口", 要根据实际情况选择合适的"路" HDU2199 Can 阅读全文
posted @ 2016-11-10 20:23 Pic 阅读(259) 评论(0) 推荐(0)
摘要:A strange lift Problem Description There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on 阅读全文
posted @ 2016-11-10 19:56 Pic 阅读(268) 评论(0) 推荐(0)
摘要:胜利大逃亡 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 21759 Accepted Submission(s): 8538 Problem 阅读全文
posted @ 2016-11-08 22:09 Pic 阅读(373) 评论(0) 推荐(0)
摘要:利用BFS求图的最短路, POJ3984 在这里,BFS求出了每个点到起点的最短距离 注意, 只要"某个点到起点的距离"从初始状态被赋值, 那么这个值就是最优的, 因为可以把BFS之后的图看为是一个BFS树, 某点的所在的"层数"就是其到起点的距离, 当其被BFS第二次的时候的"层数"一定 大于或等 阅读全文
posted @ 2016-10-12 21:37 Pic 阅读(306) 评论(0) 推荐(0)