#K95502. Upcoming Due Tasks

    ID: 38877 Type: Default 1000ms 256MiB

Upcoming Due Tasks

Upcoming Due Tasks

You are given a list of tasks. Each task has an integer task_id and a due date represented in the format YYYY-MM-DD. You are also provided with the current date and an integer D. Your objective is to output all task IDs whose due dates fall within the interval \( [current\_date,\ current\_date + D] \) (both endpoints inclusive). The output should be sorted in ascending order.

Note: If no tasks are due within the given interval, output an empty line.

inputFormat

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

  • The first line contains an integer n representing the number of tasks.
  • The next n lines each contain a task. Each task is described by two fields: an integer task_id and a due date in the format YYYY-MM-DD, separated by a space.
  • The following line contains the current date in YYYY-MM-DD format.
  • The last line contains an integer D specifying the number of days.

The tasks with due dates in the interval \( [current\_date,\ current\_date + D] \) (inclusive) are considered due.

outputFormat

The output should be written to stdout as a single line containing the sorted list of due task IDs separated by spaces. If there are no due tasks, output an empty line.

## sample
3
1 2023-10-01
2 2023-10-05
3 2023-10-10
2023-10-01
5
1 2