Problems > First Value At Least X > Editorial

First Value At Least X — Solution & Editorial

Back to the Problem

Sort once, then answer each query with lower_bound (binary search for the leftmost position with value ≥ X).

Complexity: O((N + Q) log N)