Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall.
A blockhouse is a small castle that has four openings through which to shoot. The four openings are facing North, East, South, and West, respectively. There will be one machine gun shooting through each opening.
Here we assume that a bullet is so powerful that it can run across any distance and destroy a blockhouse on its way. On the other hand, a wall is so strongly built that can stop the bullets.
The goal is to place as many blockhouses in a city as possible so that no two can destroy each other. A configuration of blockhouses is legal provided that no two blockhouses are on the same horizontal row or vertical column in a map unless there is at least one wall separating them. In this problem we will consider small square cities (at most 4x4) that contain walls through which bull
Fire Net HDU - 1045 (好题)(dfs)or(二分图匹配)
最新推荐文章于 2022-06-16 21:01:06 发布
本文介绍了如何解决一个城市广场的布局问题,目标是在地图上放置尽可能多的不会相互射击的blockhouse。这个问题可以通过二分图匹配的方法来解决。文章探讨了从最初的八皇后问题思路转向暴力搜索算法,最终发现可以使用二分图匹配的高效算法。给出了输入输出格式以及样例,并预告了下篇博客将详细讨论二分图匹配的实现。
摘要由CSDN通过智能技术生成