You are viewing a single comment's thread. Return to all comments →
the solution using if else is not very tangible since there are only three possible values that y can have. Here is my solution
int main() { int q; cin>>q; set <long long int> s; for(int i=0;i<q;i++) { int y; long long int x; cin>>y>>x; if(y==1) s.insert(x); else if(y==2) s.erase(x); else { if(s.end()==s.find(x)) cout<<"No"<<endl; else cout<<"Yes"<<endl; } } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sets-STL
You are viewing a single comment's thread. Return to all comments →
the solution using if else is not very tangible since there are only three possible values that y can have. Here is my solution