Pagini recente » Cod sursa (job #685296) | Cod sursa (job #1707233) | Cod sursa (job #1140163) | Cod sursa (job #1163665) | Cod sursa (job #2721182)
#include <iostream>
#include <fstream>
#include <set>
#define NMAX 200000
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int q, k, a[NMAX+10];
multiset <int> S;
int main()
{
fin >> q;
while(q--)
{ int type;
fin >> type;
if(type == 1)
{ int x;
fin >> x;
a[++k] = x;
S.insert(x);
}
else if(type == 2)
{ int x;
fin >> x;
multiset <int>::iterator it = S.lower_bound(a[x]);
S.erase(it);
}
else
fout << *S.begin() << '\n';
}
return 0;
}