0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-01 02:36:26 +00:00
OI-codes/Luogu/problem/P3871/P3871.cpp

27 lines
570 B
C++
Raw Normal View History

2020-11-16 10:42:08 +00:00
#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;
}