Cod sursa(job #471238)
| Utilizator | Data | 17 iulie 2010 21:11:57 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include <fstream>
#include <set>
#include <vector>
using namespace std;
set<int> heap;
vector<int> ord;
int N, cod, x;
int main() {
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
ord.push_back(0);
fin >> N;
while (N--) {
fin >> cod;
switch(cod) {
case 1:
fin >> x;
ord.push_back(x);
heap.insert(x);
break;
case 2:
fin >> x;
heap.erase(ord[x]);
break;
case 3:
fout << *heap.begin() << '\n';
break;
}
}
fin.close();
fout.close();
return 0;
}