Estimated time limit: 0.5 seconds. Memory limit: 128 MB.
The deployed limit is twice the largest per-input median runtime of the reference program on the target judge, rounded up to a multiple of
A visual editor keeps a separate list of local variables for each subroutine. Programmers insert and delete variables and edit their notes. Maintain the lists and answer queries about a variable and its neighbors.
There are
Support these operations:
| Operation | Meaning |
|---|---|
1 id |
Query the notes of the predecessor, the variable itself and the successor, within its own list. Print NULL for a missing predecessor or successor. If the variable does not exist or was deleted, print three NULL entries. |
2 id |
Delete the variable. Ignore an unassigned ID or an already deleted variable. |
3 nid |
Insert a variable at the front of list nid . |
4 nid |
Insert a variable at the back of list nid . |
5 id x |
Change the variable's note to x . Ignore an unassigned ID or an already deleted variable. |
Every insertion receives a fresh ID equal to the initial number of variables plus the number of insertions so far, including this insertion. Its initial note equals that ID. Deletion never reuses an ID. A list may become empty; inserting at either end of an empty list creates a one-element list. Editing a note does not change the ID.
Node labels are “ID: note”, and arrows indicate neighboring variables within a list. The upper pair shows the initial state of Sample 1; the lower pair shows the state after operation
The first line contains
Only 1 id operations produce output. Print three entries for the predecessor, the variable itself and the successor, using the note or NULL as appropriate. Separate entries with one space.
2
2 1
12
1 2
1 3
5 2 -7
1 1
2 1
1 2
3 1
4 2
1 4
1 5
2 2
1 2
1 2 NULL
NULL 3 NULL
NULL 1 -7
NULL -7 NULL
NULL 4 -7
3 5 NULL
NULL NULL NULL
1
1
9
2 1
1 1
1 2
3 1
1 2
2 2
4 1
1 3
1 0
NULL NULL NULL
NULL NULL NULL
NULL 2 NULL
NULL 3 NULL
NULL NULL NULL
1
2
5
5 1 42
5 2 42
1 1
2 1000000000
1 2
NULL 42 42
42 42 NULL
In Sample 1, after ID
For all inputs:
| Score | Additional conditions |
|---|---|
| 100% | No additional conditions |