King of the North: Placing bannermen surrounding castle
This appears to be a max-flow/min-cut problem. Consider the directed graph $G$ with all non-hill/wall squares as vertices and edges between the neighbouring non-hill/wall cells in the map. 

As the weights in the problem are on the vertices, but we need them as capacities on the edges, replace each vertex $u$ by the pair of vertices $u_{in}$, $u_{out}$ such that $c(u_{in},u_{out}) = w(u)$ and all incoming edges of $u$ are connected to $u_{in}$ and all outgoing edges of $u$ are connected to $u_{out}$. Give the capacity $+\infty$ to all other edges (so we cannot 'cut' those edges). 

Call our castle the sink and connect all borders of the map to a source. Note that the edges can be bidirectional, except for those connected to the source or sink.

Now, the minimum amount of bannermen to required to protect the castle is equal to the minimum value over edges in our graph $G$ we need to remove such that the sink (our castle) cannot be reached from the source (the outside of the map). This is precisely the minimum cut on this graph $G$. So, we can compute the number of men required in $O((R+C)^3)$ using the Edmonds-Karp algorithm, where $R,C$ is the amount of rows and columns in our map. Given that $R,C\leq 300$, this approach is likely fast enough to solve the problem within the time limit.



Your approach looks a lot like an heuristic approach to the min-cut problem. I don't see any reason that this would be always be correct in this case, so that approach would likely fail, as you suspect.