//杉月
#include<bits/stdc++.h>
#define N 100005
//#define double long double
//#define int long long
using namespace std;
typedef long long LL;
int n;
int a[N];
priority_queue<LL>Q;int sum;
priority_queue<LL,vector<LL>,greater<LL> >q;
void move(int m){
while(sum<m&&q.size()){
Q.push(q.top());sum++;
q.pop();
}
}
void work(){
for(int i=1;i<=n;i++){
q.push(a[i]);
if(sum)
while(Q.top()>q.top()){
q.push(Q.top());Q.pop();sum--;
}
if(i%2==1){
move((i+1)/2);
cout<<Q.top()<<endl;
}
}
}
signed main(){
//freopen("detect2.in","r",stdin);
//freopen("detect.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
work();
//fclose(stdin);
//fclose(stdout);
return 0;
}
为什么全是MLE,不理解。