Pagini recente » Cod sursa (job #992803) | Cod sursa (job #2522524) | Cod sursa (job #377841) | Cod sursa (job #2212760) | Cod sursa (job #2691728)
//ALEXANDRU MICLEA
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <time.h>
#include <iomanip>
#include <deque>
#include <math.h>
#include <cmath>
#include <assert.h>
#include <stack>
#include <bitset>
#include <random>
#include <chrono>
#include <assert.h>
using namespace std;
using ll = long long;
#include <fstream>
//ifstream cin("input.in"); ofstream cout("output.out");
ifstream cin("heapuri.in"); ofstream cout("heapuri.out");
//VARIABLES
const int maxn = 200005;
multiset <int> h;
int k = 0, pos[maxn];
//FUNCTIONS
//MAIN
int main() {
int n; cin >> n;
for (int i = 1; i <= n; i++){
int tip, val; cin >> tip;
if (tip != 3){
cin >> val;
}
if (tip == 1){
h.insert(val);
pos[++k] = val;
}
if (tip == 2) h.erase(pos[val]);
if (tip == 3) cout << *h.begin() << '\n';
}
return 0;
}