Pagini recente » Cod sursa (job #1296826) | Cod sursa (job #40049) | Cod sursa (job #1828220) | Cod sursa (job #2824240) | Cod sursa (job #2734060)
#include <bits/stdc++.h>
using namespace std;
#ifndef LOCAL
ifstream in("heapuri.in");
ofstream out("heapuri.out");
#define cin in
#define cout out
#endif //LOCAL
const int offset = (1 << (10 + 8));
int v[2 * offset];
void update(int poz, int val)
{
int index = offset + poz;
v[index] = val;
index /= 2;
while(index >= 1)
{
v[index] = min(v[index * 2], v[index * 2 + 1]);
index /= 2;
}
}
int getMin()
{
return v[1];
}
int main()
{
memset(v, 0x7f, sizeof(v));
int n; cin >> n;
int cntSize = 0;
for(int i = 0; i < n; i++)
{
int q; cin >> q;
if(q == 1)
{
int x; cin >> x;
update(cntSize, x);
cntSize += 1;
}
if(q == 2)
{
int x; cin >> x;
update(x - 1, 0x1f1f1f1f);
}
if(q == 3)
{
cout << getMin() << '\n';
}
}
}