#K36507. File Backup System
File Backup System
File Backup System
You are given a series of file modification and backup operations. The system records modifications for various files and performs backups at specified times. For each backup operation, only the files that have been modified after the previous backup (or initially, after time 0) should be included in the backup.
The operations are represented in the following formats:
MOD x t
: Indicates that filex
is modified at timet
.BACKUP t
: Indicates a backup operation at timet
. In this operation, all files modified strictly after the last backup time are included.
Your task is to simulate these operations. For every backup operation, output the list of file identifiers (in increasing order) that are backed up. If no files are to be backed up during a backup operation, output an empty line.
Note: The operations in each test case are executed sequentially. After processing a backup command, update the last backup time to the backup time provided in that command.
inputFormat
The input is read from standard input (stdin). The first line contains an integer T, the number of test cases. For each test case:
- The first line contains an integer N — the number of operations.
- The next N lines each contain an operation in one of the following formats:
MOD x t
— wherex
is a unique file identifier andt
is its modification time.BACKUP t
— wheret
is the time at which a backup is performed.
outputFormat
The output is written to standard output (stdout). For each test case, for every backup operation encountered, output a single line. This line should list the file identifiers (separated by a single space and in increasing order) that are backed up during that operation. If no file qualifies for backup, output an empty line.## sample
1
4
MOD 1 5
MOD 2 10
BACKUP 20
BACKUP 30
1 2
</p>