ICPC World Finals 2025

Problem L: Walking on Sunshine

Solved by 138 teams.

First solved after 6 minutes.

Shortest judge solution: 341 bytes.

This problem is something of a trick question: the x-coordinates are irrelevant, and it can be tackled in one dimension. There are a number of solutions based on a plane sweep. A particularly simple one is to sort the rectangles by y1, then iterate through them, merging the current rectangle with the previous one if they overlap (in y). At the end of this process, we have determined the disjoint intervals of shade, and can easily compute how much of the journey falls outside these intervals.