Cod sursa(job #2747266)
Utilizator | Data | 28 aprilie 2021 23:00:56 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.68 kb |
#include <fstream>
#include <set>
#include <vector>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int> mst;
vector<int> pos;
int main() {
int N, op, x;
fin>>N;
for(int i = 0; i < N; i++){
fin>>op;
switch (op) {
case 1:
fin>>x;
mst.insert(x);
pos.push_back(x);
break;
case 2:
fin>>x;
mst.erase(mst.find(pos[x-1]));
break;
case 3:
fout<<*mst.begin()<<'\n';
break;
default:
break;
}
}
return 0;
}