I'd bet it's NP-hard. The standard reduction to a flow problem only tells you if a cut exists (by min-cut max-flow duality), but here we want the cut of size at most N that maximizes enclosed area.
The Leetcode version of this is "find articulation points", which is just a DFS, but it's less general than what is presented here.