Pagini recente » Cod sursa (job #2420704) | Cod sursa (job #472381) | Cod sursa (job #2970581) | Cod sursa (job #1634509) | Cod sursa (job #2949358)
#include <fstream>
#include <set>
#include <unordered_map>
using namespace std;
const int nmax = 2e5;
set < int > s;
unordered_map < int, int > mp;
ifstream fin ( "heapuri.in" );
ofstream fout ( "heapuri.out" );
int main() {
int q, tip, a, elem = 0;
fin >> q;
while ( q-- ) {
fin >> tip;
if ( tip == 1 ) {
fin >> a;
s.insert ( a );
mp[elem++] = a;
} else if ( tip == 2 ) {
fin >> a; a--;
s.erase ( s.find ( mp[a] ) );
mp.erase ( a );
} else
fout << *s.begin () << '\n';
}
return 0;
}