Problem 3171 · Hard
Each end index has only about log(V) distinct OR values, so track those and compare each with k.
Open the interactive visualisation