- #include
- using namespace std;
- priority_queue<int,vector<int>,greater<int> > pq;
- int main()
- {
- int n;
- cin >> n;
- for(int i = 1;i <= n;i++)
- {
- int op;
- cin >> op;
- switch(op)
- {
- case 1:
- int x;
- cin >> x;
- pq.push(x);
- break;
- case 2:
- cout << pq.top() << endl;
- break;
- case 3:
- pq.pop();
- break;
- }
- }
- return 0;
- }