Problem Description

Capacity c. Commands: PUT k v, GET k. GET prints value or -1. Evict least recently used.

Input Format

First line c q. Next q lines.

Output Format

Outputs for GET.

Sample Test Case

Input:
2 6 PUT a 1 PUT b 2 GET a PUT c 3 GET b GET c
Output:
1 -1 3

Constraints

q

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next