E - Blackout 2 Editorial by spheniscine


Note that it doesn’t matter which power plant(s) a city is connected to. Thus, it is possible to compress all power plants into a single special vertex. As in the official editorial, queries should be solved in reverse order, but now there is no need to maintain weights (as the answer is simply “size of the component connected to the special vertex” - 1)

posted:
last update: