Angry Cows#10664

Angry Cows (Editorial)

Subtask 1

We have , and so we can afford to try every possible set of walls. For each such set, we can check the (non-)connectivity requirements using a BFS or DFS algorithm: starting from some hiking areas, and making sure not to wa