Cod sursa(job #3137300)
| Utilizator | Data | 12 iunie 2023 11:39:34 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.79 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
unordered_map <int, int> mp;
multiset <int> s;
int Q, task, val, ind;
int main(){
ios :: sync_with_stdio(false);
fin.tie(0);
fout.tie(0);
fin >> Q;
while(Q--){
fin >> task;
switch(task){
case 1:
fin >> val;
ind++;
mp[ind] = val;
s.insert(val);
break;
case 2:
fin >> val;
s.erase(s.find(mp[val]));
break;
case 3:
fout << *(s.begin()) << "\n";
break;
}
}
fin.close();
fout.close();
return 0;
}
