#K61792. Busiest Branch Identification
Busiest Branch Identification
Busiest Branch Identification
In this problem, you are given data logs from several branches of a business. Each branch has a number of log entries, where each entry is represented by a timestamp (in 24-hour format as an integer, e.g. 1500 for 3:00 PM) and the number of customers recorded at that time. You are also given a time interval defined by two integers: (start_time) and (end_time). Your task is to determine the branch that had the highest total number of customers during the time interval (start_time \leq t \leq end_time). If more than one branch has the same maximum total, choose the branch with the smallest index (branches are numbered starting from 1).
inputFormat
The input is read from standard input and has the following format:
1. The first line contains a single integer (B) denoting the number of branches.
2. The second line contains two integers (start_time) and (end_time) separated by a space, defining the time interval.
3. For each branch from 1 to (B), the input contains:
a. A line with an integer (N), the number of log entries for that branch.
b. (N) lines, each containing two integers: a timestamp and the number of customers at that time.
You must process the log entries for each branch and determine which branch has the highest sum of customer counts within the inclusive time interval.
outputFormat
Output a single integer representing the 1-indexed branch number which has the highest total number of customers during the specified time interval. The result should be printed to standard output.## sample
3
1000 1900
3
800 15
1200 40
1900 30
2
1000 20
1500 35
3
900 25
1300 15
1600 25
1