Pagini recente » Cod sursa (job #1271479) | Cod sursa (job #821818) | Istoria paginii runda/springfest/clasament | Rating Marius-Ionut Buzoi (Mariusel) | Cod sursa (job #3005265)
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int DIM = 200010;
int n, op, x;
int pos[DIM];
set<int> s;
int main() {
fin >> n;
for (int i = 1; i <= n; i++) {
fin >> op;
if (op == 1) {
fin >> x;
s.insert(x);
pos[s.size()] = x;
} else if (op == 2) {
fin >> x;
s.erase(pos[x]);
} else {
fout << *(s.begin()) << '\n';
}
}
return 0;
}