Cod sursa(job #238948)
| Utilizator | Data | 3 ianuarie 2009 18:37:26 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
multiset<int> S;
vector<int> inserted;
int main()
{
freopen("heapuri.in", "rt", stdin);
freopen("heapuri.out", "wt", stdout);
int M;
for (scanf("%d", &M); M; M--)
{
int type, val;
scanf("%d", &type);
if (type == 3)
{
printf("%d\n", *S.begin());
continue;
}
scanf("%d", &val);
if (type == 1)
{
S.insert(val);
inserted.push_back(val);
}
else
S.erase(S.find(inserted[val - 1]));
}
return 0;
}
