Mai intai trebuie sa te autentifici.
Cod sursa(job #2132297)
| Utilizator | Data | 15 februarie 2018 17:45:28 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.8 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
map <int, int> m;
multiset <int> s;
multiset <int> :: iterator it;
int main()
{
int x, op, y, i = 0, j;
fin >> op;
while (op--)
{
/// citesc operatia
fin >> x;
if (x == 1)
{
/// citesc valoare introdusa
fin >> y;
i++;
m[i] = y;
s.insert(y);
}
else if (x == 2)
{
fin >> y;
///m[y] = 0;
j = m[y];
it = s.find(j);
s.erase(it);
}
else /// x == 3
{
fout << *s.begin() << "\n";
}
}
fin.close();
fout.close();
return 0;
}
