随笔分类 -  图论

摘要:/* 请实现一个函数,用来判断一颗二叉树是不是对称的。注意,如果一个二叉树同此二叉树的镜像是同样的,定义其为对称的。 */ /* public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { ... 阅读全文
posted @ 2019-01-31 12:44 Roni_i 阅读(79) 评论(0) 推荐(0) 编辑
摘要:/** public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; } } */ /* 输入两棵二叉树A,B,判断B是不是A的子结构。(ps:我们... 阅读全文
posted @ 2019-01-31 12:12 Roni_i 阅读(104) 评论(0) 推荐(0) 编辑
摘要:A 求和 时间限制: 1 Sec 空间限制: 256 MB 输入输出文件名:A.in,A.out 题目描述 给出一棵以1为根的有n个节点的树,树上每条边都有其边权。 求所有点对之间的路径上的边权和的总和。 输入格式: 第一行为n 接下来n 1行,每行三个整数,分别表示一条边的两端点编号和边权。(编号 阅读全文
posted @ 2018-08-25 22:14 Roni_i 阅读(538) 评论(0) 推荐(0) 编辑
摘要:【例题】 1.POJ Drainage Ditches 【最大流EK算法模板】 include include include include include include include include include include include include include includ 阅读全文
posted @ 2018-08-23 12:47 Roni_i 阅读(171) 评论(0) 推荐(0) 编辑
摘要:定义 给定一个二分图G,在G的一个子图M中,M的边集{E}中的任意两条边都不依附于同一个顶点,则称M是一个匹配。 极大匹配(Maximal Matching)是指在当前已完成的匹配下,无法再通过增加未完成匹配的边的方式来增加匹配的边数。最大匹配(maximum matching)是所有极大匹配当中边 阅读全文
posted @ 2018-08-21 22:44 Roni_i 阅读(245) 评论(0) 推荐(0) 编辑
摘要:【题意建模】: 你想娶酋长的女儿,但酋长要求你给一定数额金钱的聘礼。除了金钱外,酋长也允许你用部落里其他人的某物品加上一点钱作为聘礼。而其他人的物品也可以通过指定的另外一些人的某物品加上一些金钱获得。部落里的每个人有一个等级。你的整个交易过程涉及的人的等级只能在一个限定的差值内。问你最少需要多少金钱 阅读全文
posted @ 2018-08-11 11:59 Roni_i 阅读(151) 评论(0) 推荐(0) 编辑
摘要:农夫约翰在探索他的许多农场,发现了一些惊人的虫洞。虫洞是很奇特的,因为它是一个单向通道,可让你进入虫洞的前达到目的地!他的N(1≤N≤500)个农场被编号为1..N,之间有M(1≤M≤2500)条路径,W(1≤W≤200)个虫洞。FJ作为一个狂热的时间旅行的爱好者,他要做到以下几点:开始在一个区域, 阅读全文
posted @ 2018-08-09 00:17 Roni_i 阅读(176) 评论(0) 推荐(0) 编辑
摘要:Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchang 阅读全文
posted @ 2018-08-08 23:06 Roni_i 阅读(164) 评论(0) 推荐(0) 编辑
摘要:1.正环 用 SPFA不断的进行松弛操作,发现当前金额可以比本身大就更新,同时记录更新次数。如果更新次数超过n次,说明存在”正“环。 2.负环 这里先说明下负环。(求最短距离的时候) 在我们用SPFA求最短路径的时候,如果存在负环,在松弛操作的时候总会加入队列 因为最小距离会越来越小,同样这里如果经 阅读全文
posted @ 2018-08-08 20:56 Roni_i 阅读(1612) 评论(0) 推荐(0) 编辑
摘要:Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whe 阅读全文
posted @ 2018-08-08 15:11 Roni_i 阅读(206) 评论(0) 推荐(0) 编辑
摘要:Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but 阅读全文
posted @ 2018-08-08 14:05 Roni_i 阅读(170) 评论(0) 推荐(0) 编辑
摘要:1.到底如何求k短路的? 我们考虑,要求k短路,要先求出最短路/次短路/第三短路……/第(k-1)短路,然后访问到第k短路。 接下来的方法就是如此操作的。 2.f(x)的意义? 我们得到的f(x)更小,优先访问这个f(x)的点。 我们可以定义一组数{p,g,h},p是某一个点,g是估价,h是实际,那 阅读全文
posted @ 2018-08-08 10:19 Roni_i 阅读(271) 评论(0) 推荐(0) 编辑
摘要:Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weapons have soared across the glo 阅读全文
posted @ 2018-08-08 09:45 Roni_i 阅读(146) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define debug() puts("++++") #def... 阅读全文
posted @ 2018-08-07 14:20 Roni_i 阅读(144) 评论(0) 推荐(0) 编辑
摘要:You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write 阅读全文
posted @ 2018-08-05 10:05 Roni_i 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Farmer 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 you 阅读全文
posted @ 2018-08-05 01:14 Roni_i 阅读(257) 评论(0) 推荐(0) 编辑
摘要:The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22668 Accepted: 8038 Description Given a connected undirected graph, tell if 阅读全文
posted @ 2018-08-04 23:37 Roni_i 阅读(215) 评论(0) 推荐(0) 编辑
摘要:题目描述 如题,给出一个有向图,请输出从某一点出发到所有点的最短路径长度。 输入输出格式 输入格式: 第一行包含三个整数N、M、S,分别表示点的个数、有向边的个数、出发点的编号。 接下来M行每行包含三个整数Fi、Gi、Wi,分别表示第i条有向边的出发点、目标点和长度。 输出格式: 一行,包含N个用空 阅读全文
posted @ 2018-07-11 01:10 Roni_i 阅读(205) 评论(0) 推荐(0) 编辑
摘要:(POJ)[http://poj.org/problem?id=2387] Til the Cows Come Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 69789 Accepted: 23386 Descript 阅读全文
posted @ 2018-07-11 00:05 Roni_i 阅读(251) 评论(0) 推荐(0) 编辑
摘要:Task schedule Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 515 Accepted: 309 Special Judge Description There are n preemptive jobs to be 阅读全文
posted @ 2018-06-14 09:29 Roni_i 阅读(308) 评论(0) 推荐(0) 编辑

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