Cod sursa(job #2391282)
| Utilizator | Data | 28 martie 2019 18:59:02 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.65 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
long long n,a,b,i,j;
map<long long,long long>m;
int main()
{
fin>>n;j=1;
for(i=0;i<n;i++)
{
fin>>a;
if(a==1) {
fin>>b;
m[b]=j;j++;
}
else if(a==2) {
fin>>b;
map<long long,long long>::iterator it=m.begin();
while(it!=m.end())
{
if(it->second==b) {
m.erase(it->first);break;
}it++;
}
}
else if(a==3) {
cout<<m.begin()->first<<endl;
}
}
return 0;
}
