Pagini recente » Borderou de evaluare (job #2968265) | Cod sursa (job #986388)
Cod sursa(job #986388)
#include <stdio.h>
#include <set>
#define NMAX 200005
using namespace std;
multiset<int> G;
int ORDER[NMAX],COUNT=0,N;
int main()
{
freopen ("heapuri.in","r",stdin);
freopen ("heapuri.out","w",stdout);
scanf("%d\n",&N);
int type,x,i;
multiset<int>:: iterator it;
for (i=1;i<=N;i++)
{
scanf("%d ",&type);
if (type==1)
{
scanf("%d\n",&x);
ORDER[++COUNT]=x;
G.insert(x);
}
if (type==2)
{
scanf("%d\n",&x);
G.erase(ORDER[x]);
}
if (type==3)
{
it=G.begin();
printf("%d\n",*it);
}
}
fclose(stdin);
fclose(stdout);
return 0;
}