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