#C5097. Order Log Management
Order Log Management
Order Log Management
You are tasked with managing and querying the order log of a Waffle House branch. The log supports four commands:
- ADD id time details: Add a new order with identifier id, timestamp time, and details (a string describing the order).
- DELETE id: Delete the order with the specified id.
- UPDATE id time details: Update the order with the given id if it exists.
- QUERY id: Query the order with the specified id and print its details. If it does not exist, print
NOT FOUND
.
The commands are processed sequentially. For each QUERY
command, output the current state of that order in the format id time details
, or NOT FOUND
if the order does not exist.
All numerical values are integers. If an UPDATE
command is issued for a non-existent order, it should be ignored.
Note: All formulas or mathematical expressions, if any, should use LaTeX formatting. In this problem, the operations are straightforward without complex formulas.
inputFormat
The first line contains an integer n
representing the number of commands. Each of the following n
lines contains one command. The commands are in one of the following formats:
ADD id time details
DELETE id
UPDATE id time details
QUERY id
All fields are space-separated.
outputFormat
For each QUERY
command encountered in the input, output a single line. If the order exists, print its details in the format id time details
. Otherwise, print NOT FOUND
.
Outputs should be printed to standard output.
## sample7
ADD 1 15 Pancakes
ADD 2 10 Omelette
QUERY 1
UPDATE 1 20 Waffles
QUERY 1
DELETE 2
QUERY 2
1 15 Pancakes
1 20 Waffles
NOT FOUND
</p>