Cod sursa(job #2949358)
| Utilizator | Data | 30 noiembrie 2022 15:21:01 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.64 kb |
#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;
}
