当前位置:网站首页>POJ1548 Robots【二分图最小路径覆盖】
POJ1548 Robots【二分图最小路径覆盖】
2022-07-27 12:35:00 【51CTO】
题目链接:
http://poj.org/problem?id=1548
题目大意:
在一个N*M(N <= 24,M <= 24)的图中,有很多垃圾, 清理垃圾的机器人从左上角开始清理。已
知机器人只能向右或是向下清理垃圾,在清理完一个地方的垃圾后可以继续向右或是向下去清理
其他垃圾。最终运行到(N,M)的位置终止。问:最少需要多少个机器人,能清理完所有的垃圾。
思路:
图中没有给N和M的大小,只是给出了垃圾的位置。输入用0 0表示一组数据输入结束。建一个结构
体来存储垃圾的坐标值。现在来建一个二分图,图的两边就是垃圾的节点,遍历原图,如果垃圾j在
垃圾i的右下角,就将(i,j)加入到二分图中,最后问题就变为了:求该二分图的最小路径覆盖。由二
分图最小路径覆盖 = 点数 - 二分图最大匹配,根据匈牙利算法求出二分图最大匹配,然后得出结果。
AC代码:
边栏推荐
- Set interface
- 详述try-catch-finally
- heap
- Interviewer: how can you close an order without using a scheduled task?
- 2021-3-19-byte-face value
- Nodejs body parser middleware processes post form data of type multipart / form data, and req.body cannot receive data
- QT | qcheckbox of control
- 关于2022年3月9日之后Typora登录不了--已解决
- Keil mdk5.37 and above can add AC5 (armcc) compiler by themselves
- C program debugging and exception handling (try catch)
猜你喜欢

Implicit indicators for evaluating the advantages and disadvantages of automated testing

Configuration files in MySQL

Overview of famous inner classes and anonymous inner classes

ArrayList常用方法总结

J9 number theory: how long is the mainstreaming of decentralized identity?

Laboratory procedures and references of chloramphenicol acetate

Julia beginner tutorial 2022

分布式系统架构理论与组件

MySQL扩展

BSP video tutorial issue 21: easy one key implementation of serial port DMA variable length transceiver, support bare metal and RTOS, including MDK and IAR, which is more convenient than stm32cubemx (
随机推荐
CVPR22 | 关系意识的图神经架构搜索
Chain representation and implementation of queues
20210422 consolidation interval
NFT mall /nft blind box / virtual blind box /nft transaction / customizable second opening
POJ1988_ Cube Stacking
P1876 turn on the light [getting started]
最强分布式锁工具:Redisson
Laboratory procedures and references of chloramphenicol acetate
The strongest distributed locking tool: redisson
详述jdbc查询方法执行过程
SQL question brushing: find out the current salary of all employees
详述try-catch-finally
关于2022年3月9日之后Typora登录不了--已解决
【萌新解题】斐波那契数列
Photoshop web design tutorial
An overview of kernel compilation system
SSM实战项目-前后分离(简单易懂)
POJ1611_ The Suspects
一款能模糊的地方都能模糊的测试工具——Wfuzz
Switching value input and output module dam-5055