The distance field idea came to me too.
But wouldn;t it be simpler to subtract 0.25, then clamp 0-1, then add 0.25 to get the 0.5 and 1.0 left alone then do the same for 0.5 to get just 1.0 on its own. You can do it the other way around as well and do some min/max tricks to isolate the one you want.