#include <bits/stdc++.h>
using namespace std;
set <int>a;
int main(){
ios::sync_with_stdio(false);
int n,p,len;
cin>>n;
while (n--){
cin>>p>>len;
if (p==1){
if (a.find(len)!=a.end())cout<<"Already Exist";
else a.insert(len);
}else if (a.empty())cout<<"Empty";
else{
set<int>::iterator i=a.lower_bound(len),j=i;
if (j!= a.begin())--j;
if (i!=a.end()&&len-(*j)>(*i)-len)j=i;
cout<<(*j)<<endl;
a.erase(j);
}
}
return 0;
}
怎么回事啊,样例过了全WA!