#C8849. Robots Requiring Maintenance

    ID: 52876 Type: Default 1000ms 256MiB

Robots Requiring Maintenance

Robots Requiring Maintenance

You are given a list of robots and a current date. Each robot is characterized by a unique robot_id, its last maintenance date and a maintenance interval (in days). A robot requires maintenance if the current date is greater than or equal to the date computed by adding its maintenance interval to its last maintenance date.

In mathematical terms, let \(L\) be the last maintenance date, \(I\) be the maintenance interval (in days) and \(C\) be the current date. A robot requires maintenance if:

[ C \geq L + I\text{ (in days)} ]

The task is to output the list of robot IDs that require maintenance, preserving the input order. If no robot requires maintenance, output an empty line.

inputFormat

The input is read from stdin and is formatted as follows:

  • The first line contains a string representing the current date in the format YYYY-MM-DD.
  • The second line contains an integer n denoting the number of robots.
  • Each of the next n lines contains three values separated by spaces: an integer robot_id, a string last_maintenance_date in the format YYYY-MM-DD, and an integer maintenance_interval (in days).

outputFormat

The output should be written to stdout. Print the robot_id of each robot that requires maintenance, separated by a space, in the order they appear in the input. If no robot requires maintenance, print an empty line.

## sample
2023-10-15
3
101 2023-09-10 30
102 2023-10-01 14
103 2023-09-25 20
101 102 103