Cod sursa(job #2620627)
| Utilizator | Data | 29 mai 2020 12:32:59 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | cex_ph_6 | Marime | 0.77 kb |
#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';
}
}
}
