#C11085. Art Collection Damage Management

    ID: 40362 Type: Default 1000ms 256MiB

Art Collection Damage Management

Art Collection Damage Management

You are given an art collection consisting of n art pieces, indexed from 0 to n-1. Initially, all art pieces are undamaged.

You need to process q operations. There are two types of operations:

  • damage i: Mark the art piece at index i as damaged. If the index is invalid (i.e. not in the range [0, n-1]), this operation should be ignored.
  • print: Output the indices of all undamaged art pieces in ascending order, separated by a single space. If there are no undamaged art pieces, output an empty line.

Your task is to implement the operations and produce the correct output for every print query.

Note: Once an art piece is marked as damaged, it remains damaged permanently.

inputFormat

The first line contains an integer n (the number of art pieces).

The second line contains an integer q (the number of operations).

The following q lines each contain an operation in one of the following formats:

  • damage i
  • print

outputFormat

For each print operation, output a single line containing the indices of the undamaged art pieces separated by a space. If no art pieces remain undamaged, output an empty line.

## sample
5
1
print
0 1 2 3 4