Pagini recente » Cod sursa (job #3199785) | Cod sursa (job #2699610) | Cod sursa (job #1353475) | Cod sursa (job #2436206) | Cod sursa (job #3030889)
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int DIM = 200010;
int n, op, x, cnt;
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[++cnt] = x;
} else if (op == 2) {
fin >> x;
s.erase(pos[x]);
} else {
fout << *(s.begin()) << '\n';
}
}
return 0;
}