错的都错在第一行
#include <bits/stdc++.h>
using namespace std;
const int maxn=1000010,maxm=100100;
int n,m,a[maxn];
string s;
priority_queue<int,vector<int>,greater<int> >qr;
priority_queue<int>ql;
void add(){
int num;
scanf("%d",&num);
if(num<=ql.top())ql.push(num);
else qr.push(num);
}
void mid(){
int tot=ql.size()+qr.size();
while(ql.size()<tot/2){
ql.push(qr.top());
qr.pop();
}
while(qr.size()<tot/2){
qr.push(ql.top());
ql.pop();
}
if(ql.size()==qr.size())printf("%d\n",min(ql.top(),qr.top()));
else if(ql.size()==qr.size()-1)printf("%d\n",qr.top());
else if(ql.size()==qr.size()+1)printf("%d\n",ql.top());
else printf("Error\n");
}
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int i=1;i<=n/2;i++)ql.push(a[i]);
for(int i=n/2+1;i<=n;i++)qr.push(a[i]);
scanf("%d",&m);
while(m--){
cin>>s;
if(s[0]=='a')add();
else if(s[0]=='m')mid();
}
return 0;
}