当前位置:网站首页>POJ2594 Treasure Exploration【二分图最小路径覆盖】【Floyd】
POJ2594 Treasure Exploration【二分图最小路径覆盖】【Floyd】
2022-07-27 12:36:00 【51CTO】
题目链接:
http://poj.org/problem?id=2594
题目大意:
给你N个地点,M条有向边,已知构成的图是有向无环图。现在要在地点上放机器人通过M
条边来遍历N个地点,问:最少需要多少个机器人可以遍历N个地点。
思路:
这是一道求最小路径覆盖的题目。和一般最小路径覆盖的题目不一样的地方是:这里的点可
以重复遍历。也就是可以有两个及以上的机器人经过同一个点。那么,先建立一个二分图,
两边都为N个地点。然后在原图的基础上,用Floyd求一次传递闭包,也就是如果点i可以到达
点j,而点j可以到达点k,那么可以当做点i可以直接跳过点j而到达点k,就可以建立一条有向
边(i,k)。建好图后,就是一般的二分图最小路径覆盖的问题了。而二分图最小路径覆盖 =
点数 - 二分图最大匹配,用匈牙利算法求出二分图最大匹配就可以了。
AC代码:
边栏推荐
- Keil mdk5.37 and above can add AC5 (armcc) compiler by themselves
- 2021-4-7-find the maximum water holding capacity
- JS true / false array conversion
- 592. 分数加减运算 : 表达式计算入门题
- JVM memory layout detailed, illustrated, well written!
- Photoshop web design tutorial
- CMD Chinese garbled code solution
- An overview of kernel compilation system
- Julia beginner tutorial 2022
- 视频游戏沉迷行为研究综述
猜你喜欢

Interviewer: how to deal with the data loss of redis master-slave cluster switching?

Dominoes staged: the beginning and end of the three arrow capital crash

Laboratory procedures and references of chloramphenicol acetate

20210518-Cuda

HDU1698_Just a Hook

4. Analysis of the execution process of make modules for general purposes

Openpyxl drawing area map

Shutter project scrollcontroller attached to multiple scroll views, failed assertion: line 109 POS 12 error handling

What are metauniverse and NFT digital collections?

V. introduction of other objectives and general options
随机推荐
js日期时间格式化(年月日、时分秒、星期、季度、获取时间差、日期与时间戳转换的功能)
5V boost 9V chip
【萌新解题】斐波那契数列
2021-03-15
Will causal learning open the next generation of AI? Chapter 9 Yunji datacanvas officially released the open source project of ylarn causal learning
关于2022年3月9日之后Typora登录不了--已解决
Map接口
20210408 longest public prefix
Implicit indicators for evaluating the advantages and disadvantages of automated testing
PySide6/PyQt开发经验总结(2) - 设置快捷键
The strongest distributed locking tool: redisson
数据湖(二十):Flink兼容Iceberg目前不足和Iceberg与Hudi对比
详述try-catch-finally
Necessary foundation: Signature Verification
Getting started for beginners: build your own blog with WordPress
Plus版SBOM:流水线物料清单PBOM
2021-3-19-byte-face value
正则表达式去除两端空格
Enjoy the luxury meta universe louis:the game, and participate in the NFT series digital collection white roll activity | tutorial
JS date and time format (year, month, day, hour, minute, second, week, quarter, time difference acquisition, date and timestamp conversion function)