#include
using namespace std;
int n,m,s[100010];
void f1(int a)
{
s[m]=a;	
m++;
}
void f2()
{
int e;
sort(s,s+m-1);
e=s[m-1];
cout<<e<<endl;
}
void f3()
{
sort(s,s+m-1);
s[m-1]=0;
m--;
}	
int main()
{
int a[100010],b[100010];
cin>>n;
for(int i=1;i<=n;i++)
{
scanf("%d %d",&a[i],&b[i]);
}
for(int i=1;i<=n;i++)
{
if(a[i]==1) {f1(b[i]);}
if(a[i]==2) {f2();}
if(a[i]==3) {f3();}	
}		
return 0;
}

0 comments

No comments so far...

Information

ID
1242
Time
1000ms
Memory
256MiB
Difficulty
7
Tags
# Submissions
14
Accepted
10
Uploaded By