Pagini recente » Cod sursa (job #17798) | Cod sursa (job #608525) | Cod sursa (job #1056359) | Cod sursa (job #275453) | Cod sursa (job #3174871)
#include <bits/stdc++.h>
#include <random>
#include <chrono>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const char nl = '\n';
const char sp = ' ';
const int inf = 0x3f3f3f3f;
const long long INF = 1000000000000000000;
const int mod = 1e9 + 7;
const char out[2][4]{ "NO", "YES" };
#define all(a) a.begin(), a.end()
using ll = long long;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
#define variableName(var) #var
#define __debug(var) cout << #var << " = " << var << '\n'
inline int rint(int a, int b) { return uniform_int_distribution<int>(a, b)(rng); }
const int nmax = 2e5;
int n = 0, q;
int v[nmax + 5]{ 0 };
multiset<int> ms;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
fin >> q;
while (q--) {
int t, x;
fin >> t;
if (t == 1) {
fin >> x;
v[++n] = x;
ms.insert(x);
}
else if (t == 2) {
fin >> x;
ms.erase(ms.find(v[x]));
}
else {
fout << *ms.begin() << nl;
}
}
}