摘要: Problem Description You are given a complete graph with N vertices, numbered from 1 to N. The weight of the edge between verte... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 【概述】 对于单源最短路来说,有时间复杂度为 O(E+VlogV) 要求权值非负的 Dijkstra,时间复杂度为 O(VE) 适用于带负权值的 Bellman Ford 对于全源最短路来说,除了时间复杂度为 O(V*V*V) 利用动态规划思想的 Floyd ... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 【概述】 最短路是图论中十分常见的一个问题,可分为单源最短路与全源最短路。 对于单源最短路来说,有时间复杂度为 O(E+VlogV) 要求权值非负的 Dijkstra,时间复杂度为 O(VE) 适用于带负权值的 Bellman Ford 对于全源最短路来说,有... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 【基本概念】 1.网络流 给定一个有向图 G=(V,E),在这个图中: 有唯一的一个源点 S(入度为 0,出发点)有唯一的一个汇点 T(出度为 0,结束点)图中的每条弧(u,v)都有一非负容量 c(u,v)此时称图 G 为网络流图(容量网络),记为:G=(V,... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(551) 评论(0) 推荐(1) 编辑
摘要: 题目描述 如题,给出一个网络图,以及其源点和汇点,每条边已知其最大流量和单位流量费用,求出其网络最大流和在最大流情况下的最小费用。 输入输出格式 输入格式: 第一行包含四个正整数N、M、S、T,分别表示点的个数、有向边的个数、源点序号、汇点序号。 ... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(15) 评论(0) 推荐(0) 编辑
摘要: Problem Description There are n heroes and m monsters living in an island. The monsters became very vicious these days, so the ... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(42) 评论(0) 推荐(0) 编辑
摘要: Problem Description Years later, Jerry fell in love with a girl, and he often walks for a long time to pay visits to her. But, ... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(39) 评论(0) 推荐(0) 编辑
摘要: Problem Description You’ve finally got mad at “the world’s most stupid” employees of yours and decided to do some firings. You’... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 【概述】 给出一个有向图,每一个点都有一个权值,现在要选择一个权值和最大的子图,使得每个点的后继都在子图中,这个子图就称为最大权闭合子图。 如上图,能选的子图有:Ø、{1,2,3,4,5,6}、{3,6}、{2,4,5,6}、{4,6}、{5,6}、{6}、... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(33) 评论(0) 推荐(0) 编辑
摘要: Problem Description Master QWsin is dating with Sindar. And now they are in a restaurant, the restaurant has n dishes in order.... 阅读全文
posted @ 2022-09-20 22:50 老程序员111 阅读(17) 评论(0) 推荐(0) 编辑