Problem 2852 · Medium

Sum of Remoteness of All Cells

Label each connected region once; every cell in a region shares the value sitting outside it, so the answer is a sum of region sizes times outside totals.

Open the interactive visualisation