Cod sursa(job #1215575)

Utilizator pavlov.ionPavlov Ion pavlov.ion Data 1 august 2014 14:10:44
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.65 kb
#include<fstream>
#include<set>
#define LL long long
#define MAXN 200005 
using namespace std;
ifstream cin("heapuri.in");
ofstream cout("heapuri.out");
LL N,R[MAXN];
multiset <LL> myset;
int main() {
	LL i,k=0,X;
	int op;
	cin>>N;
	for(i=1;i<=N;i++) {
	   cin>>op;
	     switch(op) {
		 	case 1 : { cin>>X;
			          R[++k]=X;
					  myset.insert(X);
					  break;
					  }
			case 2 : { cin>>X;
			          myset.erase(myset.find(R[X]));
			          break;
					  }
			case 3 : { cout<<*myset.begin()<<"\n";
			          break;
					  }
					  } //end switch
} //end for
return 0;
}