Competition#481

Competition (Editorial)

First, we need to sort the events in non-decreasing order of time. Next, we can maintain a moment when the team has left, or "-1" if the team is currently present at the performance. When a new event for team arrives, we need to check if , if last_a \neq -1, and assign last_a := t otherwise. If the condition t - last_a > X is satisfied for the team, it becomes disqualified. The set of disqualified teams can be maintained using an array with states .