#C9518. Elevator Activity Summary
Elevator Activity Summary
Elevator Activity Summary
You are given a list of elevator trips. Each trip is represented by three integers: the start floor, the end floor, and the number of people on that trip. Your task is to summarize the elevator's activity.
The output should include:
- Total Trips: The total number of trips.
- Total People: The sum of the number of people in all trips.
- Busiest Trip: The trip with the maximum number of people. In case of a tie, choose the one that appears first.
- Most Frequent Floor: The floor (from either the start or end floor of a trip) that appears most frequently. In case of a tie, choose the floor that appears first when counting in order of occurrence.
If there are no trips, output zeros and None for the trip and floor.
Note: All formulas or mathematical expressions should be formatted in \(\LaTeX\)
if needed. For example, the total number of trips is \(n\), and the sum of people is \(\sum_{i=1}^{n}p_i\), where \(p_i\) is the number of people in the \(i\)-th trip.
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
n start1 end1 people1 start2 end2 people2 ... startn endn peoplen
Here, n
is an integer representing the number of elevator trips. Each of the following n
lines contains three integers: the starting floor, ending floor, and the number of people for that trip.
outputFormat
The program should print the summary of the elevator activity on standard output (stdout) in exactly four lines:
- Total number of trips.
- Total number of people.
- The busiest trip represented as three integers (start floor, end floor, number of people), or
None
if there is no trip. - The most frequent floor, or
None
if there is no trip.
0
0
0
None
None
</p>