Pagini recente » Cod sursa (job #2623811) | Cod sursa (job #660709) | Cod sursa (job #2737375) | Cod sursa (job #6878) | Cod sursa (job #2620627)
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
typedef pair<int,int> p;
priority_queue <p,vector<p>,greater<p>> h;
vector <int> v(200005);
vector <bool> sel(200005);
int n;
int main()
{
f>>n;
int cnt=0;
for(int i=1;i<=n;i++)
{
int t;
f>>t;
if(t==1)
{
int x;
f>>x;
++cnt;
v[cnt]=x;
h.push({x,cnt});
}
else if(t==2)
{
int x;
f>>x;
sel[x]=true;
}
else if(t==3)
{
while(sel[h.top().second])
{
h.pop();
}
g<<h.top().first<<'\n';
}
}
}