Cod sursa(job #1870341)
| Utilizator | Data | 6 februarie 2017 16:35:42 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.67 kb |
#include<bits/stdc++.h>
using namespace std;
ofstream g("heapuri.out");
const int NMAX = 200005;
set<int>myHeap;
set<int>::iterator it;
int N, operation;
void citire()
{
ifstream f("heapuri.in");
f>>N;
for(int i = 1; i <= N; i++)
{
f>>operation;
if(operation == 1)
{
int x;
f>>x;
myHeap.insert(x);
}else if(operation == 2)
{
int y;
f>>y;
myHeap.erase(y);
}else if (operation == 3) {
g<<*myHeap.begin()<<"\n";
//myHeap.clear();
}
}
}
int main()
{
citire();
return 0;
}
