Cod sursa(job #3363484)
| Utilizator | Data | 18 august 2026 16:07:26 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.66 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int t;
set<int> s;
vector<int> v;
int main(){
fin >> t;
while(t--){
int tip; fin >> tip;
if(tip == 1){
int x; fin >> x;
v.push_back(x);
s.insert(x);
}
else if(tip == 2){
int poz; fin >> poz;
s.erase(v[poz - 1]);
v.erase(v.begin() + poz);
}
else{
int rez;
for(auto i : s){
rez = i;
break;
}
fout << rez << '\n';
}
}
}
