Cod sursa(job #2626027)
| Utilizator | Data | 6 iunie 2020 11:29:10 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.73 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
int main()
{
ifstream f("heapuri.in");
//ofstream g("heapuri.out");
set <int> v;
set <int> :: iterator j;
int nr, poz[200001], k = 1, k2 = 0;
f>>nr;
for(int i=1; i<=nr; i++)
{
int x, y;
f>>x;
if(x == 1)
{
f>>y;
v.insert(y);
k2++;
poz[k++] = y;
for(j = v.begin(); j != v.end(); j++)
cout<<*j<<" ";
cout<<endl;
}
else if(x == 2)
{
f>>y;
v.erase(poz[y]);
}
//else
//g<<*(v.begin())<<"\n";
}
return 0;
}
