Pagini recente » Borderou de evaluare (job #3012119) | Borderou de evaluare (job #1511776) | Cod sursa (job #800366) | Borderou de evaluare (job #1516938) | Cod sursa (job #3312401)
// RULE: There shouldnt be any spaces in the code, except after commas.
// RULE: All variables in main should be declared globally, and can be used before they are defined.
// RULE: All open curly braces should be placed on the same line as the function or control structure they belong to, not on the line after.
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in"); //strudel
ofstream fout("heapuri.out");
priority_queue<int, vector<int>, greater<int>> pq;
int a[200010];
int n,i,x,c,a1;
map<int,bool> m;
int main()
{
fin>>n;
for(i=1;i<=n;i++){
fin>>c;
if(c==1) fin>>a[++a1], pq.push(a[a1]), m[a[a1]]=1;
else
if(c==3) fout<<pq.top()<<'\n';
else{
fin>>x;
x=a[x];
m[x]=0;
while(m[pq.top()]==0) pq.pop();
}
}
return 0;
}