Pagini recente » Cod sursa (job #1733619) | Cod sursa (job #2840141) | Cod sursa (job #739909) | Cod sursa (job #2313455) | Cod sursa (job #2450667)
#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 200005;
const int buffer = 1000000;
int N;
int len;
int Array[N_MAX];
char buff[buffer];
int pos = -1;
set < int > Set;
void readBuffer() {
fread(buff, sizeof(char), buffer, stdin);
}
char readChar() {
++pos;
if (pos == buffer) {
readBuffer();
pos = 0;
}
return buff[pos];
}
int readInt() {
char c;
int ans = 0;
while (!isdigit(c = readChar())) ;
while (isdigit(c)) {
ans = 10 * ans + (c - '0');
c = readChar();
}
return ans;
}
int main() {
freopen("heapuri.in", "r", stdin);
freopen("heapuri.out", "w", stdout);
cin >> N;
while (N--) {
int t, x;
t = readInt();
if (t == 1) {
x = readInt();
Set.insert(x);
Array[++len] = x;
} else if (t == 2) {
x = readInt();
Set.erase(Array[x]);
} else {
cout << * Set.begin() << "\n";
}
}
return 0;
}