Pagini recente » Cod sursa (job #1353315) | Cod sursa (job #1441958) | Cod sursa (job #2728042) | Cod sursa (job #2582787) | Cod sursa (job #2949359)
#include <fstream>
#include <set>
#include <unordered_map>
using namespace std;
multiset < 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;
}