$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
pythonimport sys n, t = map(int, sys.stdin.readline().split()) events = [] for _ in range(n): l, r = map(int, sys.stdin.readline().split()) events.append((l, 1)) events.append((r, -1)) events.sort() current = 0 max_p = 0 for time, delta in events: current += delta if current > max_p: max_p = current print(max_p)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.