修练者
题目链接: 酷町堂:4066
```cpp
//#pragma GCC optimize(3,"Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
#include <bits/stdc++.h>
#define JS ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
using namespace std;
int n;
priority_queue<int, vector<int>, greater<int>> qn;
priority_queue<int, vector<int>, less<int>> qx;
void clear() {
while (!qn.empty()) {
qn.pop();
}
while (!qx.empty()) {
qx.pop();
}
}
int main() {
JS;
while (cin >> n) {
cout << "Passed" << "\n\n";
clear();
cout << "Passed" << "\n\n";
int t;
for (int i = 1; i <= n; i++) {
cin >> t;
if (t > qn.top()) {
qn.push(t);
} else {
qx.push(t);
}
}
cout << "Passed" << "\n\n";
if (qn.size() > qx.size()) {
while (qn.size() != qx.size() + 1) {
qx.push(qn.top()), qn.pop();
}
} else {
while (qn.size() != qx.size() + 1) {
qn.push(qx.top()), qx.pop();
}
}
cout << "Passed" << "\n\n";
if (n % 2 == 1)
cout << qn.top() << '\n';
else {
cout << (qn.top() + qx.top()) / 2 << '\n';
}
cout << "Passed" << "\n\n";
}
return 0;
}
```