Pagini recente » Istoria paginii runda/simulare-cartita-24 | Cod sursa (job #2193075) | Cod sursa (job #852879) | Cod sursa (job #887679) | Cod sursa (job #1608502)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int NMax = 2e5 + 5;
int Pos[NMax];
set < int > Set;
int main(){
int n, c, x, k;
set < int > ::iterator it;
fin >> n;
k = 0;
while(n--){
fin >> c;
if(c == 1){
fin >> x;
Pos[++k] = x;
Set.insert(x);
} else {
if(c == 2){
fin >> x;
it = Set.find(Pos[x]);
if(it != Set.end()) Set.erase(it);
} else {
fout << *Set.begin() << "\n";
}
}
}
return 0;
}