Злі корови#10664

Злі корови (Розбір)

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