Cod sursa(job #412602)

Utilizator xtephanFodor Stefan xtephan Data 5 martie 2010 20:21:42
Problema Heapuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.82 kb
#include<fstream>
#include<set>

using namespace std;

struct comp {
	
	bool operator()(long i, long j) {
		return i<j;
	}
	
};


multiset<long,comp> heap;
long N;
long poz[200005];

int main() {
	
	long t,k=0,x;
	
	/*
	freopen("heapuri.in", "r", stdin);
	freopen("heapuri.out", "w", stdout);
	
	scanf("%d",&N);
	*/
	
	ifstream fin("heapuri.in");
	ofstream fout("heapuri.out");
	
	fin>>N;
	
	for(long i=1; i<=N;i++) {
		
		//scanf("%d",&t);
		fin>>t;
		if(t==1) {
			//scanf("%d",&x);
			fin>>x;
			heap.insert(x);
			poz[++k]=x;
		}
		
		if(t==2) {
			//scanf("%d",&x);
			fin>>x;
			heap.erase(poz[x]);
		}
		
		
		if(t==3) {
			//x=*heap.upper_bound(0);
			//printf("%d\n",x);
			//fout<<*heap.upper_bound(0)<<"\n";
		}
	}
	
	
	fin.close();
	fout.close();
	
	return 0;
}