Problem Description

You are given an array and update operations. If any operation is invalid (index out of range), rollback everything and print ROLLBACK and original array. Else print OK and final array.

Input Format

Line1: n. Line2: n integers. Line3: m. Next m lines: SET i x or ADD i d (0-based).

Output Format

Two lines: status and array.

Sample Test Case

Input:
3 1 2 3 2 ADD 1 5 SET 2 9
Output:
OK 1 7 9

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next