Cod sursa(job #3329233)

Utilizator DariusJohnDarius Dumitrescu DariusJohn Data 12 decembrie 2025 13:18:45
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.52 kb
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int main() {
  int n, k = 0;
  map<int, int> mp;
  vector<int> v;
  fin >> n;
  for (int i = 0; i < n; i++) {
    int type;
    fin >> type;
    if (type == 1) {
      int x;
      fin >> x;
      v.push_back(x);
      mp[x]++;
    }
    if (type == 2) {
      int x;
      fin >> x;
      mp.erase(v[x - 1]);
    }
    if (type == 3)
      fout << mp.begin()->first << "\n";
  }
  return 0;
}