Pagini recente » Cod sursa (job #352331) | Cod sursa (job #2211010) | Monitorul de evaluare | Cod sursa (job #654265) | Cod sursa (job #3312402)
// 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;
}