#C6093. File Management System Simulation

    ID: 49815 Type: Default 1000ms 256MiB

File Management System Simulation

File Management System Simulation

You are given a sequence of commands to simulate a file management system. There are two types of operations: file operations (creation and modification) and query operations.

The commands are in the following format:

  • create filename timestamp: Creates a new file with the given name at the specified timestamp.
  • modify filename timestamp: Logs a modification for the file at the given timestamp.
  • last_modified filename: Queries the most recent modification timestamp for the file. If the file does not exist or has never been modified, output "File does not exist".
  • modified_within filename start end: Checks if the file has any modification timestamp within the range \( [start, end] \) (inclusive). Output "Yes" if it has, otherwise output "No".

The input terminates with a line that contains just a single #.

Note: All timestamps are positive integers. For any formulas, use LaTeX formatting. For example, the condition for a timestamp t in the range is given by \( start \leq t \leq end \).

inputFormat

Each line of input is a command as described. The input ends when a line containing a single '#' is encountered. Commands include:

  • create filename timestamp
  • modify filename timestamp
  • last_modified filename
  • modified_within filename start end

outputFormat

For each query command ('last_modified' and 'modified_within'), output the result on a new line in the order the queries appear in the input.## sample

create file1 1
modify file1 3
create file2 2
modify file1 5
modify file2 4
last_modified file1
last_modified file2
last_modified file3
modified_within file1 2 4
modified_within file2 1 3
#
5

4 File does not exist Yes No

</p>