13920
Never
#include<iostream> #include<set> #include<cmath> using namespace std; int main(){ set<int> s; int N,tmp; cin >> N; while(N--){ cin >> tmp; if(tmp==1){ cin >> tmp; auto i = s.find(tmp); if(i!=s.cend()) s.erase(i); else s.insert(tmp); } else if(tmp==2){ cin >> tmp; auto a=s.lower_bound(tmp); if(a==s.cend()||(a==s.cbegin()&&*a!=tmp)){ cout << "-1\n"; } else if(a==s.cbegin()&&*a==tmp){ auto b = a;b++; if(b==s.cend()) cout << "-1\n"; //tmp exists, but only one number else cout << *b - *a << endl; //tmp exists and is segment's left bound } else{ auto b = a;b--; cout << *a - *b << endl; //tmp exists and is segemnt's right bound } } } return 0; }
Raw Text
-
Untitled
3 min ago
-
Untitled
9 min ago
-
It’s Daisy’s First Day As A FreeUse Cleaning Lady For Her Master, And She's Eager To Learn The
11 min ago
-
Adult Telegram Channels
18 min ago
-
https://www.facebook.com/ZenCortexHearingSupplement/
19 min ago
-
Untitled
30 min ago
-
Top 8 Ways To Buy A Used Hero Keto Acv Gummies Reviews
35 min ago
-
Oem Keto Gummies Australia(2024) 100% Safe, Does It Really Work Or Not?
38 min ago
-
Hot Desi Bhabhi Sex Fingering Her Shaved Indian Pussy
41 min ago
-
https://twor.microsoftcrmportals.com/forums/support-forum/6653c3ea-9400-ef11-a73d-6045bd3fd1cb
43 min ago