#K55652. Zone Monitoring System

    ID: 30023 Type: Default 1000ms 256MiB

Zone Monitoring System

Zone Monitoring System

This problem simulates a monitoring system across multiple zones. You are given n zones and must process m requests. Each request is in one of the following formats:

  • monitor i: Start monitoring zone i if it is not already being monitored.
  • stop i: Stop monitoring zone i if it is currently being monitored.

If you attempt to monitor an already monitored zone, output "Zone i is already monitored". Similarly, if you try to stop monitoring a zone that is not monitored, output "Zone i is not monitored". Otherwise, output appropriate messages indicating that monitoring has started or stopped.

For example, if the input request is monitor 3 and zone 3 is not monitored, output Monitoring started in zone 3. The output should consist of one line per request.

inputFormat

The input is given via standard input and consists of multiple lines. The first line contains two integers n and m separated by a space, where n is the number of zones and m is the number of requests. The next m lines each contain a request in the format monitor i or stop i, where i is the zone number.

outputFormat

For each request, print a single line to standard output with one of the following messages:

  • "Monitoring started in zone i"
  • "Zone i is already monitored"
  • "Monitoring stopped in zone i"
  • "Zone i is not monitored" where i is the zone number.## sample
5 7
monitor 3
monitor 2
stop 3
stop 2
monitor 5
stop 1
monitor 3
Monitoring started in zone 3

Monitoring started in zone 2 Monitoring stopped in zone 3 Monitoring stopped in zone 2 Monitoring started in zone 5 Zone 1 is not monitored Monitoring started in zone 3

</p>