Skip to main content

· One min read

Another problem that had me looking at my wrong answer for a while not understanding what was happening. This time I realized that a group with negative units could attack (because it had been killed previously in the round).

· One min read

The first part for this problem was pretty straight forward, simply calculate the erosion level for each region and transform that into region types before summing the ones in the desired region. Since you're multiplying big integers, at some point there be overflow, but since you're also doing modulo operations, you can work with modulo arithmetic from the start and only conserve the remainder when computing the erosion level of a region.