Sets-STL

  • + 0 comments

    include

    include

    include

    include

    include

    include

    using namespace std;

    int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */

    int n;
    cin>>n;
    
    set<int> s;
    
    while(n--){
        int a,b;
        cin>>a>>b;
        if(a==1){
            s.insert(b);
        }
        else if(a==2){
            s.erase(b);
        }
        else if(a==3){
            set<int>::iterator itr = s.find(b);
            if(itr!=s.end()){
                cout<<"Yes"<<endl;
            }
            else{
                cout<<"No"<<endl;
            }
        }
    }
    
    return 0;
    

    }