Rosetta Problems

Power Grid Blackout Crisis

https://atcoder.jp/contests/awc0031/tasks/awc0031_e