_Glassy_Sky_ @ 2023-01-11 21:52:40
#include<bits/stdc++.h>
#include<queue>
using namespace std;
priority_queue<int> qmax;
priority_queue<int, vector<int>, greater<int> > qmin;
int main()
{
int n, x, y;
cin >> n >> x;
qmin.push(x);
for(int i = 3; i <= n; i += 2)
{
cin >> x >> y;
if(x > y)
swap(x, y);
qmin.push(x);
qmax.push(y);
if(qmin.top() > qmax.top())
{
int a = qmin.top(); qmin.pop();
int b = qmax.top(); qmax.pop();
qmin.push(b);
qmax.push(a);
}
cout << qmin.top() << "\n";
}
return 0;
}