Skip to content

cookingwater

bradendubois edited this page Jun 9, 2021 · 6 revisions

Cooking Water

ID: cookingwater

Difficulty: 1.9

CPU Time: 1 second

Memory: 1024 MB

Solution

If Gunilla is right, and they all might boil at the same time, that means there is some window of time which is present in every [a, b]. To see if Edward is right, for each interval read in, check and store what the lowest b value seen is, and what the highest a value seen is. If the highest a is > the lowest b, there are (at least) two intervals of time with no overlap, and so water cannot boil at the same time.

Clone this wiki locally