55555555~找不出错误
跪求大佬帮忙
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> a;
int n, op, x, k1, k2;
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) {
// cout << "**"; for (int j = 0 ; j < a.size(); ++j) cout << a[j] << " "; cout << endl;
cin >> op >> x;
if (op == 1) {
if (a.size() == 0) {a.push_back(x); continue;}
if (a[lower_bound(a.begin(), a.end(), x) - a.begin()] == x) cout << "Already Exist" << endl;
else a.insert(lower_bound(a.begin(), a.end(), x), x);
} else {
if (a.size() == 0) {cout << "Empty" << endl; continue;}
k2 = lower_bound(a.begin(), a.end(), x) - a.begin();
int y;
if (k2 != a.size()) y = a[k2]; else y=1e9;
k1 = k2 - 1; int z; if(k1>=0)z = a[k1];else z=-1e9;
if (x - z <= y - x) {
a.erase(k1 + a.begin());
cout << z << endl;
} else {
a.erase(k2 + a.begin());
cout << y << endl;
}
}
}
return 0;
}