Pagini recente » Cod sursa (job #2892006) | Cod sursa (job #1558296) | Cod sursa (job #1642120) | Cod sursa (job #2971169) | Cod sursa (job #480710)
Cod sursa(job #480710)
#include <cstdio>
#include <set>
using namespace std;
#define file_in "heapuri.in"
#define file_out "heapuri.out"
int T;
int cnt[1<<18];
int nr=0;
multiset<int> H;
inline void adfile()
{
freopen(file_in,"r",stdin);
freopen(file_out,"w",stdout);
scanf("%d", &T);
}
inline void solve()
{
int tip,x;
for (int i=1;i<=T;++i)
{
scanf("%d", &tip);
if (tip!=3) scanf("%d", &x);
if (tip==1)
{
cnt[++nr]=x;
H.insert(x);
}
if (tip==2)
{
H.erase(H.find(cnt[x]));
}
if (tip==3)
printf("%d\n", *H.begin());
}
}
int main()
{
adfile();
solve();
fclose(stdin);
fclose(stdout);
return 0;
}