$N$ persons visited a restaurant. The restaurant is open from 0 to $T$. The $i$-th…
- User
persons visited a restaurant. The restaurant is open from 0 to . The -th person entered the restaurant at and left at . Find the maximum number of persons during the business hours.
Assistant
pythonn, t = map(int, input().split()) events = [] for _ in range(n): l, r = map(int, input().split()) events.append((l, 1)) events.append((r, -1)) events.sort() max_count = 0 current_count = 0 prev_time = 0 for time, delta in events: if prev_time < time: if current_count > max_count: max_count = current_count current_count += delta prev_time = time if prev_time < t: if current_count > max_count: max_count = current_count print(max_count)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.