Problem Recommendation System Version 1
Time limit1sMemory limit512 MB
Maintain a set of problems with difficulty values under add, remove, and query commands that ask for the hardest or easiest problem with a tie-break on problem number.
- Level
Medium5 of 10
- Topics
- Heap, Hash map, Implementation, Sorting
- Solved
- No attempts yet
Problem
tony9402 recently picked problems for coding test practice on GitHub and organized them by "problem number, difficulty".
He wants to add a new feature for people who study using GitHub.
There are three commands he wants to build. The table below describes each command.
The command recommend is given only when the recommended problem list has at least one problem.
The command solved is given only when the recommended problem list has at least one problem number.
Build a recommendation system that performs the commands above.
Input
The first line gives the number of problems in the recommended problem list.
From the second line to line , problem number and difficulty are given, separated by a space.
Line gives the number of commands to be entered.
From the next line, commands described above are entered.
Output
Every time a recommend command is given, print the problem number, one per line. At least one recommend command is given.
Constraints
- , is a positive integer