#K51667. Sensor Alert Report
Sensor Alert Report
Sensor Alert Report
You are given a series of sensor messages. Each message is formatted as SensorID:HH:MM:Status
, where:
- SensorID is an integer representing the sensor's unique identifier.
- HH:MM represents the time in 24-hour format.
- Status is a string which can be either
OK
orALERT
.
Your task is to process the messages to generate an alert report. Specifically, you must:
- Count the total number of messages with a status of
ALERT
. - List all distinct sensor IDs that reported an alert in ascending order.
- Determine the time of the last alert (i.e. the time from the last message with status
ALERT
in the given order).
</p>
- The first line contains an integer $n$, the number of sensor messages.
- The next $n$ lines each contain a sensor message in the format
SensorID:HH:MM:Status
. - The first line contains the total number of alerts (an integer).
- The second line contains the distinct sensor IDs (space-separated) that reported alerts in ascending order. If there are no alerts, print
None
. - The third line contains the time of the last alert in the format
HH:MM
. If there are no alerts, printNone
.
If there are no alerts, the list of sensor IDs and the last alert time should be reported as None
.
The time should be output in the format HH:MM
.
For reference, if we let $n$ be the number of messages and $m_i$ be each message, then a message is defined as:
\[ m_i = \texttt{SensorID:HH:MM:Status} \]inputFormat
The input is given via stdin in the following format:
outputFormat
The output should be printed to stdout in three lines:
6
1:08:30:OK
2:09:15:ALERT
3:10:00:ALERT
4:10:30:OK
2:10:45:ALERT
1:11:00:OK
3
2 3
10:45
</p>