I was trying to solve the King of the North problem in Kattis. Basically, the problem is, the king has a castle to protect. To do this, he wants to place bannermen across the open areas surrounding the castle (some parts are closed thanks to natural barriers).
A more detailed description of the problem: Given a grid of $R$ rows and $C$ columns, where one square contains our castle and some contain walls. We can place bannermen, who can blockade a square. Each open square has a different amount of bannermen required to form a blockade, which is given. Our task is to determine the minimum amount of bannermen that have to be fielded such that the castle is unreachable from the edge of the grid. (walls and blockaded squares are impassable)
Please go through the attached link for an even more detailed (and colourful) description of the problem.
My idea to solve this:
Go to each outermost corner of the map. From each of these points, do a A* search. This will give the shortest path from the point to the castle.
For each such point on the shortest path, try to see which ones are 'critical' - meaning placing bannermen on those points will force the enemy to take a longer path.
Among all such critical points, see which ones need lesser bannermen.
Anyone has a better idea?
I do not like my approach, particularly because it involves heuristics, and I am not sure whether it is correct.