0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 01:58:48 +00:00
OI-codes/Luogu/P3871/P3871.cpp

26 lines
563 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, t;
string op;
vector<int> nums;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> t;
nums.insert(lower_bound(nums.begin(), nums.end(), t), t);
}
cin >> m;
for (int i = 0; i < m; i++) {
cin >> op;
if (op == "add") {
cin >> t;
nums.insert(lower_bound(nums.begin(), nums.end(), t), t);
} else {
cout << nums[nums.size() / 2 - (nums.size() & 1 ^ 1)] << endl;
}
}
return 0;
}